Page 1 of 1

Query in Db2 Index .

PostPosted: Sat Jun 06, 2015 7:59 am
by gauthamnagpur18
Hi,

I have a query in Db2 index concept.

Lets say table XYZ has A to Z columns.

& let's assume table XYZ has two index.

First index is for A & B column.

Second index is for A,B,E column.

Query:

When my SQL query refers to this table XYZ, which index would be referred. Whether it depends on fields given on "Where clause" ?

Thanks in advance.

Re: Query in Db2 Index .

PostPosted: Wed Jun 17, 2015 12:25 am
by alexm
Hi gauthamnagpur18

I think there's no definite answer to your question.

However, if you have a DB2 system available you can play around with, create a PLAN_TABLE, try using the SQL 'EXPLAIN' statement and query column ACCESSNAME in the PLAN_TABLE afterwards.

Also, a good starting point for further reading would be Investigating SQL performance by using EXPLAIN (if you're on DB2 for z/OS 10), or any other DB2 documentation that describes the conditions for a good access path selection, e.g. try this search over the IBM webpages

Best regards,
alexm

Re: Query in Db2 Index .

PostPosted: Wed Jun 17, 2015 12:51 am
by gauthamnagpur18
Hi Alexm,

Thanks.

Regard,
Gautham