Search code examples
sqldatabasequery-optimizationsybase

Sybase Jconnect Driver - What is default fetch size and if increasing fetch size can benefit me


I am using Sybase Jconnect Driver Jconn3 to execute stored procs which return upto a million rows of data. I have learnt from here and there that using a greater fetch size can improve the timing to fetch all the data.

  • However I can't figure out that what is the default fetch size for Sybase Jconnect Driver. Can you help with what is default fetch size sybase uses.
  • And given that I have sufficient memory/cpu resources to handle million resources together, is it advisable to set fetchSize to everything?

Solution

  • Fetch Size sets the number of rows returned in a block from the server. It's normally set at 0, which means return all rows at one time. If you have the memory to accept 1,000,000 rows at one time, then you can just leave the setting alone.

    If you want to check it, just call getFetchSize() on the statement object. (You may need to cast the object in to a SybStatement to do this.)