Unix Technical Forum

RE: indexes

This is a discussion on RE: indexes within the Informix forums, part of the Database Server Software category; --> Tom In the specific example you quote the index will be used to directly retrieve the required records, order ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 08:50 AM
Simmons, Keith
 
Posts: n/a
Default RE: indexes


Tom

In the specific example you quote the index will be used to directly retrieve
the required records, order of where clause does not matter.
What will stop a direct index read and cause an index scan (full or partial)
is if not all the indexed fields, in sequence, are used in the where clause
(ie where col1 and col3 would be OK, where col1 and col4 would cause in index
scan on all col1 matches).
Also if you use an IN clause, or BETWEEN or MATCHES (especially on any
other than the last column in the index) you will get an index scan (or even
table scan if the optimiser thinks this would be quicker).
SET EXPLAIN ON; is your friend.

Keith

-> -----Original Message-----
-> From: tomcaml@yahoo.com [mailto:tomcaml@yahoo.com]
-> Sent: Wednesday, March 02, 2005 5:28 PM
-> To: informix-list@iiug.org
-> Subject: indexes
->
->
-> hello
->
-> stull fuzzy on index retrieval and the order of the indexed
-> fields....
->
-> if i have a table with these columns indexed (col1, col3, col4)
-> and the sql says col1, col4, col3 does the index still get used or
-> does it stop at col1 because of the order?
->
-> i assume always using the exact order of fields in the sql
-> to match the
-> indexes is the way to be correct but am unsure about different orders
-> or if the sql has two out of four included but they are either in the
-> same order or ordered differently.
->
-> thanks in advance!
->
-> tom
->

************************************************** ********************************
This message is sent in strict confidence for the addressee only. It may
contain legally privileged information. The contents are not to be disclosed
to anyone other than the addressee. Unauthorised recipients are requested
to preserve this confidentiality and to advise the sender immediately of any
error in transmission.
This footnote also confirms that this email message has been swept for the
presence of computer viruses, however we cannot guarantee that this message
is free from such problems.
************************************************** ********************************


sending to informix-list
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 08:50 AM
tomcaml@yahoo.com
 
Posts: n/a
Default Re: indexes

Thanks.
Are you thinking an IN is slower than a NOT IN, given all other things
are equal ?




Simmons, Keith wrote:
> Tom
>
> In the specific example you quote the index will be used to directly

retrieve
> the required records, order of where clause does not matter.
> What will stop a direct index read and cause an index scan (full or

partial)
> is if not all the indexed fields, in sequence, are used in the where

clause
> (ie where col1 and col3 would be OK, where col1 and col4 would cause

in index
> scan on all col1 matches).
> Also if you use an IN clause, or BETWEEN or MATCHES (especially on

any
> other than the last column in the index) you will get an index scan

(or even
> table scan if the optimiser thinks this would be quicker).
> SET EXPLAIN ON; is your friend.
>
> Keith
>
> -> -----Original Message-----
> -> From: tomcaml@yahoo.com [mailto:tomcaml@yahoo.com]
> -> Sent: Wednesday, March 02, 2005 5:28 PM
> -> To: informix-list@iiug.org
> -> Subject: indexes
> ->
> ->
> -> hello
> ->
> -> stull fuzzy on index retrieval and the order of the indexed
> -> fields....
> ->
> -> if i have a table with these columns indexed (col1, col3, col4)
> -> and the sql says col1, col4, col3 does the index still get used

or
> -> does it stop at col1 because of the order?
> ->
> -> i assume always using the exact order of fields in the sql
> -> to match the
> -> indexes is the way to be correct but am unsure about different

orders
> -> or if the sql has two out of four included but they are either in

the
> -> same order or ordered differently.
> ->
> -> thanks in advance!
> ->
> -> tom
> ->
>
>

************************************************** ********************************
> This message is sent in strict confidence for the addressee only. It

may
> contain legally privileged information. The contents are not to be

disclosed
> to anyone other than the addressee. Unauthorised recipients are

requested
> to preserve this confidentiality and to advise the sender immediately

of any
> error in transmission.
> This footnote also confirms that this email message has been swept

for the
> presence of computer viruses, however we cannot guarantee that this

message
> is free from such problems.
>

************************************************** ********************************
>
>
> sending to informix-list


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:38 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com