-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Optional support for results as arrays. #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added support to return each row as an array instead of an object, which can provide large performance benefits for large numbers of rows. Enabled by setting the new rowtype attribute to 'array'. Made the field names a public part of the results, needed since they are not part of each row.
I like this, appreciate the pull request, and will merge this. I'm going to tweak the code style a bit to bring it more in line with the rest of the library. There was a time when I was busy w/ personal stuff & didn't have a lot of time to work on node-postgres I would merge things without changing the style. Now going back there are sections of the code that look strange to me so I'm going to try to maintain a more consistent style. Anyways...this looks good 👍 |
Any updates? Looking forward to have this feature also. |
@runk thanks for the nudge - sorry I dropped out on this one - I'll get to this right now. |
Support for this will be very welcome +1 |
just an update - I have this in a feature branch locally. Once it's solid it will land. Things are going slow for various reasons including vacation & new job etc. I haven't forgotten & apologize again for the delay. |
What about also adding a "rowDecription" event ? |
Working on this now: https://github.com/brianc/node-postgres/tree/issues/324 Also added field information to result object. |
add support for result rows as arrays
closed in #393 |
@brianc nice one! 💯 |
@runk sorry it took so long! Been so busy with everything, but I'm trying to spend some time early mornings working on bug fixes & patches. 🕐 |
Hi,
This commit adds support for a new config attribute
rowtype
which can be set to "array". If done, each row is an array of values instead of a full object. This has had enormous performance benefits for a couple of projects that sent a lot of rows to a client for processing. (The client side also maintained the values as arrays.) It is also much more convenient for working with some graphing libraries such as flot.Since the field names are not part of the rows when this is enabled, the ones already attached to the result (_fieldNames) were made publicly accessible.
I've been using this for a few weeks, primarily for pages that return multiple query results in one page during initialization (lots of tables and graphs) and seems solid.