Oracle Odbc Driver Configuration Fetch Buffer Size

On
Oracle Odbc Driver Configuration Fetch Buffer Size 3,8/5 5482 votes

Jun 13, 2013 - In the ODBC Driver Setup dialog box, increase the Prefetch Count value. The ODBC driver buffer size is too small. Between frequency of queries to the database and amount of memory required for each fetch operation. Oracle ODBC Driver now allows application to specify the parameters to a. Data source configuration option and replaced it with the option 'Fetch Buffer Size'. Simba Oracle ODBC Driver 1.2.4. To configure SSL verification: Configure SSL authentication on your Oracle database, and make sure that the tnsnames.ora.

In JDBC the default fetch size is 10, but I guess that's not the best fetch size when I have a million rows. I understand that a fetch size too low reduces performance, but also if the fetch size is too high.

Oracle Odbc Drivers

How can I find the optimal size? And does this have an impact on the DB side, does it chew up a lot of memory?

KKOKKO

4 Answers

As with (almost) anything, the way to find the optimal size for a particular parameter is to benchmark the workload you're trying to optimize with different values of the parameter. In this case, you'd need to run your code with different fetch size settings, evaluate the results, and pick the optimal setting.

Odbc

In the vast majority of cases, people pick a fetch size of 100 or 1000 and that turns out to be a reasonably optimal setting. The performance difference among values at that point are generally pretty minimal-- you would expect that most of the performance difference between runs was the result of normal random variation rather than being caused by changes in the fetch size. If you're trying to get the last iota of performance for a particular workload in a particular configuration, you can certainly do that analysis. For most folks, though, 100 or 1000 is good enough.

Justin CaveJustin Cave

If your rows are large then keep in mind that all the rows you fetch at once will have to be stored in the Java heap in the driver's internal buffers. In 12c, Oracle has VARCHAR(32k) columns, if you have 50 of those and they're full, that's 1,600,000 characters per row. Each character is 2 bytes in Java. So each row can take up to 3.2MB. If you're fetching rows 100 by 100 then you'll need 320MB of heap to store the data and that's just for one Statement. So you should only increase the row prefetch size for queries that fetch reasonably small rows (small in data size).

Jean de LavareneJean de Lavarene

The default value of JDBC fetch size property is driver specific and for Oracle driver it is 10 indeed. The fugees blunted on reality download zip.

For some queries fetch size should be larger, for some smaller.

I think a good idea is to set some global fetch size for whole project and overwrite it for some individual queries where it should be bigger.

Look at this article:

there is description on how to set up fetch size globally and overwrite it for carefully selected queries using different approaches: Hibernate, JPA, Spring jdbc templates or core jdbc API. Driving license check uk. And some simple benchmark for oracle database.

As a rule of thumb you can:

  • set fetchsize to 50 - 100 as global setting
  • set fetchsize to 100 - 500 (or even more) for individual queries
przemek hertelprzemek hertel

JDBC does have default prefetch size of 10. Check out OracleConnection.getDefaultRowPrefetch in JDBC Javadoc

Microsoft Oracle Odbc Driver Download

NirmalaNirmala

Oracle Odbc Driver Configuration Tns Service Name

Not the answer you're looking for? Browse other questions tagged oraclememoryjdbcfetch or ask your own question.