Replies: 3 comments 5 replies
-
Have you seen We could allow providing an options object eg |
Beta Was this translation helpful? Give feedback.
-
Regrettably compression is not always in play. For results of ~500+ rows significant content-length reduction is seen. Bear in mind, database column names can be legacy, poorly chosen and long. On client side, I have found processing to be slightly easier with array of arrays vs array of objects but codebase is almost identical. I will add a single array of objects could have smaller memory impact than "array of arrays" but I've yet to take time to measure and ultimately it will vary depending on client (or server) implementation. Again I will explore .raw() and see what I might learn. |
Beta Was this translation helpful? Give feedback.
-
Thank you for this - gave it a try and thus far is perfect. |
Beta Was this translation helpful? Give feedback.
-
See - https://node-postgres.com/features/queries Row Mode
The concept is to be able create a result with similar shape as:
This can significantly reduce http response size since repeated attribute names are omitted.
cols can simply utilize the statement.columns already provided.
If there is a means to use raw() please provide an example.
Alternatively perhaps consider, ".rowmode()" but it is not clear if that could be combined with existing .unsafe()
There may be existing codebases seeking to migrate from node-postgres and in short-term utilizing .unsafe()
Beta Was this translation helpful? Give feedback.
All reactions