Skip to content

Adjust fetch size on queries #2097

Closed
Closed

Description

@glena

Hi, we are suffereing from hight ClientWaits and one thing we would like to try is to make the fetch size bigger when we receive many results from the query. I cannot find anything related to this in the docs or the code (to be honest I have to dig deeper yet), is there any way to play with this value?

Am I right to assume this rows (https://github.com/brianc/node-postgres/blob/master/packages/pg/lib/query.js#L27) config defined the amount of rows to fetch by the cursor each time? I dont find docs around this

Activity

  1. brianc commented on Feb 4, 2020

    @brianc
    Owner
  2. glena commented on Feb 4, 2020

    @glena
    Author

    I am talking about the analogous to this JDBC configuration. At this point we are running out of ideas and experimenting with a setting as such will help us to tune or discard the hypothesis
    https://medium.com/@FranckPachot/oracle-postgres-jdbc-fetch-size-3012d494712

  3. brianc commented on Feb 4, 2020

    @brianc
    Owner
  4. glena commented on Feb 7, 2020

    @glena
    Author

    I have being playing with this and works as expected (probably is worth documenting). PG will split the results into batches of x rows which helps avoiding flooding the consumer on large result-sets (or unbounded queries). It is not helping our particular case as we were under the assumption that by default it will use a small batch (as the java driver does) but turns out it just gets everything from one transfer.

    I could not test fast-connection yet, what is the current status? is it production ready or you are still polishing out?

    what is the main differences between both?

    Thank you!

  5. siddhsql commented on May 6, 2023

    @siddhsql
  6. brianc commented on May 8, 2023

    @brianc
    Owner

    You can use a Cursor which afaik is eqv: https://node-postgres.com/apis/cursor
    This is the answer. Use a cursor if you don't want all the results read into memory at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions