Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Please feel free to close this PR since might an not required optimisation and also I can't seem to prove practically why this would be helpful but in theory :
Using vercel postgres on production and preview mode instead of node-postgres.
The reason for above is:
Vercel-postgress is nicely optimized to work in serverless envionemnt and it also manages the db connections itself nicely without us needing to anything.
Since in serverless environment functions are ephemeral like they spin up to handle a request and then shut down. So if we use node-postgres with
Client
then it will again and again start / stop db connections probably also increasing the latency or might create multiple unecessary connections.With vercel-postgress I think they handle above case nicely and also some other optimization.
ANother change which I did was switching from node-postgres
Client
=>Pool
. This change was not required at all since now we are usingnode-postgress
only in local development but usingPool
instead ofClient
is lot closer vercel-postgress in how they manage connections / multiple concurrent request. But again this changes was indeed not required at all.But yeah please feel free to close this PR!! and this changes is not that much required at all considering our users / requests to the application lol we might be only saving $0.0000.......1 with this changes or maybe no change at all