Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 07:25 AM
Ross Klatte
Guest
 
Posts: n/a
Default multi-part keys

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/
  #2  
Old November 12th, 2005, 07:25 AM
Ross Klatte
Guest
 
Posts: n/a
Default Re: multi-part keys

>If I have a key comprised of Column-1 plus Column-2, and if I[color=blue]
>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?
>
>[/color]

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/
  #3  
Old November 12th, 2005, 07:25 AM
Mark A
Guest
 
Posts: n/a
Default Re: multi-part keys

"Ross Klatte" <klatteross@aol.commmm> wrote in message
news:20040516145559.04109.00000673@mb-m21.aol.com...[color=blue]
> 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[/color]

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).


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,335 network members.