Q and A

Asked and Answered

I have a large table that needs to be available at all times. I use a staging table for data loading, then I INSERT from the staging table into the large table. However; there are at least three other non-partitioned indexes (NPIs), which makes inserting to the large table time consuming. How would you deal with NPIs in this situation?

Robert Catterall responds:

A couple of thoughts come to mind. First, there is the new (with DB2 for OS/390 Version 7) option of executing a LOAD RESUME with SHRLEVEL CHANGE, allowing read/write data access by programs to occur while the new data is being added to the table. I do not have performance numbers, but I expect that, in terms of efficiency and elapsed time, online LOAD RESUME would come in somewhere between traditional "offline" LOAD and SQL INSERT.

You could also think about getting rid of some or all of the NPIs on the table. One way to do that is to replace an index with a table. Suppose, for example, that you have an NPI on column ABC in your table (I'll call it BIG_TABLE), and that the partitioning index is column XYZ. Conceivably, you could have a table with columns ABC and XYZ (I'll call this one XREF_TABLE). You get rid of the NPI on column ABC of BIG_TABLE. If a query that targets BIG_TABLE has a predicate referencing column ABC, you change the query to be a join of BIG_TABLE and XREF_TABLE. Will the query be more CPU-intensive, and will it take longer to execute? Probably, but a two- or three-way join needn't be a big hog if the tables involved have indexes that are a good match for the predicates.

Of course, if your INSERT job for BIG_TABLE now has to insert rows into XREF_TABLE as well, the added cost may cancel out the savings attributable to the removal of the NPI on column ABC defined on BIG_TABLE.


See a complete archive of reader/author Q&As .

CAREER CENTER
Ready to take that job and shove it?
SEARCH JOBS
RECENT JOB POSTINGS
CAREER NEWS
10 Search Engines You Don't Know About
Go beyond Google and get vertical. These specialized search sites will help you find the business information you need -- fast.

Subscribe to the new digital version of IBM Database Magazine
New Digital Version

Sponsored links:



Subscribe to the IBM Database Magazine Newsletter

Email Address *
First Name
Last Name
HTML Preference
HTML Text
 

Fields with * are required.

 




Visit these other IBM and TechWeb Partner Sites: :
Maximizing ROI Through Business Process Management (BPM) and Service-Oriented Architecture (SOA)
Internet Evolution – The Macrosite for News, Analysis, & Opinion About the Future of the Internet
Business Innovation – Technology Strategies and Solutions for Driving Business Success


:: IBM Database Magazine ::