-
Notifications
You must be signed in to change notification settings - Fork 57
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
chore: Optimize postgres - use of rowCallback approach #2171
Conversation
There were a bunch of milliseconds being lost due to multiple row processing. This commit aims to have the minimum possible row process time.
This PR may contain changes to database schema of one of the drivers. If you are introducing any changes to the schema, make sure the upgrade from the latest release to this change passes without any errors/issues. Please make sure the label |
You can find the image built from this PR at
Built from 3145510 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read through and totally awesome work! Thank you!!!
@Ivansete-status: One concern I thought about, but not connected directly to this PR. |
Thanks for the comment! I agree to review the "SQL injection" issue in the future. |
Indeed, prepared statement secure that one as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks!
logScope: | ||
topics = "postgres asyncpool" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't log anything anymore? Or was it not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! It was not used. In fact, all the exposed procs
return Result
so it is pretty likely that we won't need many longs in this file.
Description
This represents a quite important time reduction in Postgres queries. However, still slower than SQLite.
The main issue happened because the we were processing the obtained rows multiple times, and there were an overhead due to changing the rows objects from one type to another.
In this PR we aim to reduce the type conversion overhead by providing a
rowCallback(result: ptr PGresult)
to thedbconn
object.( Thanks to @NagyZoltanPeter for the help to achieve that. )
Changes
rowCalback
to retrieve rows in a more direct way.Issue
#1842