View previous topic :: View next topic
|
Author |
Message |
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Suppose I have a below query,
Code: |
Select emp_id,Dep_id,Name
from tableA
where
Dep_id=20
with ur; |
Now on tableA, the indexing sequence is in below format,
Code: |
Index info:
TableA.INDX001
emp_id
Dep_id |
So in this case would the above index will be considered or it will just ignore and do a table space scan as because of Dep_id is at second position in the index creation??
Thanks,
Rohit |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why don't you look at the EXPLAIN output and tell us the answer to your question? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
It depends on DB2 version, cardinality of emp_id,dep_id, number of pages,clusterratio of the index,... but most likely DB2 will choose a tablescan. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
I am trying doing that, but not finding such existing queries. but if any one is already knowing this then would save my time.
Aslo current version is V9.1 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I am trying doing that, but not finding such existing queries. |
You should run the Explain on YOUR query - not some existing query.
Quote: |
but if any one is already knowing this then would save my time. |
The advice you've been given is probably the best you will get with the limited info we have available.
And keep in mind that we are not here to save your time, but to help people with how/why questions and help solve problems. What you are working on Should take your time . . . |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Yes Dick, noted.
I will update you all with the explain result. |
|
Back to top |
|
|
|