TechTip: Maximize ODBC Performance in Microsoft Office

DB2
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
Have you ever looked at the iSeries Access ODBC data source name (DSN) setup dialog and wondered if any settings existed that could help improve performance with your favorite ODBC application? This tip focuses on settings that can impact ODBC performance with Microsoft Office. I'll provide some performance numbers to give you a rough idea for how the different settings may help you, but keep in mind that the numbers are arbitrary. Depending on the table, PC, network, and iSeries server you are working with, you may receive different performance results.

One of the typical ways Microsoft Office is used with ODBC is to bring data from your iSeries server down to the PC. In Microsoft Excel, you download data by using the Get External Data option found in the Data menu. In Microsoft Access, you use the Import or Link Tables options to download data.

If your table contains lots of rows, a setting to look at is the "Use blocking with a fetch of 1 row" option. This option can be found by configuring your ODBC DSN through ODBC Administrator, clicking the Performance tab, and then clicking the Advanced button. The "Record blocking size (KB)" option on this dialog is tied with the "Use blocking with a fetch of 1 row" option and controls how much data the ODBC driver will retrieve at one time. By default, 32K of data will be retrieved. In some cases, this can result in only one row being retrieved at a time. By increasing the block size to a higher value, such as 1024K, you can receive significantly more rows at a time. By reducing the number of trips the ODBC driver makes to the server, performance is improved. In a test I ran where my table contained 10,000 records, the time to retrieve the data was improved from 13 seconds to 8 seconds.

If your table contains large objects (LOBs), the setting of the "Large object (LOB) threshold (KB)" can affect performance. This option is found on the same dialog as the "Use blocking with a fetch of 1 row" option. The default value for this option is 32K. If the table is defined with a LOB field larger than 32K, the ODBC driver will retrieve the LOB data with additional trips to the server. In a test I ran where the LOB threshold was less than the LOB field size, it took approximately 22 seconds to retrieve the results. By adjusting the LOB threshold to a higher value, the performance improved to 8 seconds. By adjusting the "Record blocking size (KB)" from 32K to 1024K, the performance improved to 4 seconds.

Another setting that helps a lot is the "Enable data compression" setting on the Performance tab of the ODBC DSN setup dialog. This option is enabled by default. This setting allows the ODBC driver to compress data that is transferred between the iSeries and PC, reducing network traffic. In most cases, you want to leave this enabled. In one test I ran, leaving this option enabled improved performance by almost 10 times!

Another option that is usually very helpful is the "Enable extended dynamic (package) support" option found on the Package tab of the ODBC DSN setup dialog. The benefit of this option is normally seen when running SQL statements multiple times through the same application. Microsoft Excel does not appear to make SQL statement calls in a way that would lend itself to this option being helpful, though. However, you might get some benefit with packages when using Microsoft Access.

Several other settings on the Performance tab can help performance, but the benefit from them is slight. The "Enable pre-fetch of data for queries" and "Enable lazy close support" options both reduce the number of trips to the server by one. That will help a little, but not to the same magnitude as the other settings.

Brent Nelson is a Staff Software Engineer at IBM Rochester. He has worked on client database access technologies, such as ODBC and .NET, since joining IBM. He can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS