Unix Technical Forum

RE: Index question

This is a discussion on RE: Index question within the Informix forums, part of the Database Server Software category; --> > -----Original Message----- > From: owner-informix-list@iiug.org [SMTP wner-informix-list@iiug.org] > On Behalf Of Dirk Moolman > Sent: Tuesday, May 17, ...


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, 09:20 AM
Bill Dare
 
Posts: n/a
Default RE: Index question




> -----Original Message-----
> From: owner-informix-list@iiug.org [SMTPwner-informix-list@iiug.org]
> On Behalf Of Dirk Moolman
> Sent: Tuesday, May 17, 2005 10:17 AM
> To: informix-list@iiug.org
> Subject: Index question
>
> We have a new query, with a where-clause:
>
> where a < b (a & b are date fields)
> and c = 0 (c can have values from 0 to 270)
> and d = "2" (d can have 4 different values)
>
>
> What is the best way to write this where clause, and which are the
> best
> indexes to use ?
>
> The table has a total of 32 million records.
>
>
>
>
> My own thoughts were:
>
> where d = "2" (get rid of most of the records)
> and c = 0 (reduce the above subset to about 25%)
> and a < b (leave the sequential scan for this remaining
> data
> set)


The order that you use in the where is not supposed to affect
the optimizer. The optimizer will create a query plan based on
statistics, data distributions and the indexes which exist on the table.


> And create indexes on c & d (which brings up another question -
> composite or stand alone ?)


Composite and use the column with the best selectivity as the
lead column. You need to create data distributions with update
statistics and then look at them with dbschema to decide which column
has the best selectivity.

Regards,
Bill






> sending to informix-list


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 10:42 AM.


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