By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,135 Members | 1,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,135 IT Pros & Developers. It's quick & easy.

multi-part keys

P: n/a
If I have a key comprised of Column-1 plus Column-2, and if I
Select X where Column-2 = "yyy"
then I suppose that the retrieval takes place on a pure
sequential basis just as if I were selecting on some column
not part of any key. Is that right?
Ross
Vontay, Virginia
http://community.webshots.com/user/ross_klatte
http://www.geocities.com/foundlingfather/
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
>If I have a key comprised of Column-1 plus Column-2, and if I
Select X where Column-2 = "yyy"
then I suppose that the retrieval takes place on a pure
sequential basis just as if I were selecting on some column
not part of any key. Is that right?


p.s.
What is the objection, if any, of adding another index comprised
of Column-2 plus Column-1?
Ross
Vontay, Virginia
http://community.webshots.com/user/ross_klatte
http://www.geocities.com/foundlingfather/
Nov 12 '05 #2

P: n/a
"Ross Klatte" <kl********@aol.commmm> wrote in message
news:20***************************@mb-m21.aol.com...
If I have a key comprised of Column-1 plus Column-2, and if I
Select X where Column-2 = "yyy"
then I suppose that the retrieval takes place on a pure
sequential basis just as if I were selecting on some column
not part of any key. Is that right?
Ross
Vontay, Virginia


In the case you described above, DB2 will "usually" do a index scan rather
than a tablespace scan of the data pages. So that means DB2 will read all
the index leaf pages sequentially instead of using the b-tree of the index.

Instead of creating another index on (column-2, column-1) just create a new
index on column-2. Column-1 in this new index would be redundant if you keep
the first index (column-1, column-2).
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.