If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > unique index not untilized for large table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-17-04, 01:52
szehau szehau is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Unhappy unique index not untilized for large table

I have a very large table (a few millions of rows) in my db2 database:

create table test ( c1 integer not null, c2 integer not null, c3 integer not null, c4 integer not null )

create unique index testInd on test(c2, c4)

sql1: select max(c2) from test
sql2: select min(c2) from test
when I run the sql above in db2expln, it tells me that the sql1 is using relation scan and this doesn't happen in a small table. while sq2 is Ok for small and large table.

execution time for sql1 in large table is extremely slow!!! can anyone expert help me to solve the problems. for your information i did runstats (with/without distribution) on that large table.


Please help. thanks
SzeHau
Reply With Quote
  #2 (permalink)  
Old 04-17-04, 04:22
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: unique index not untilized for large table

Use the ALLOW REVERSE SCAN option in the CREATE INDEX Statement

Check the SQL Reference for the correct syntax ...

HTH

Sathyaram



Quote:
Originally posted by szehau
I have a very large table (a few millions of rows) in my db2 database:

create table test ( c1 integer not null, c2 integer not null, c3 integer not null, c4 integer not null )

create unique index testInd on test(c2, c4)

sql1: select max(c2) from test
sql2: select min(c2) from test
when I run the sql above in db2expln, it tells me that the sql1 is using relation scan and this doesn't happen in a small table. while sq2 is Ok for small and large table.

execution time for sql1 in large table is extremely slow!!! can anyone expert help me to solve the problems. for your information i did runstats (with/without distribution) on that large table.


Please help. thanks
SzeHau
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 04-17-04, 23:31
szehau szehau is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Re: unique index not untilized for large table

Quote:
Originally posted by sathyaram_s
Use the ALLOW REVERSE SCAN option in the CREATE INDEX Statement

Check the SQL Reference for the correct syntax ...

HTH

Sathyaram

Any other solution other than changing the original database schema.. like tweaking the sql... because the the schema is used for cross-platform and different DBMS like informix
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On