Re: Help with composite indices
Posted in 1997
Bradford Young <byoung@cornercap.com> wrote: :I've read how to create a composite index, but I'm unsure about :how to use one to order output or join tables. In my db, I have :tables with company id's and dates, with the combination of :id and date being unique. So I can create an index on (id, date). :Can I use that index for joining tables? :Can I use that index when I come to the "order by" part of a :select statement? Just a little addition to the responses you have gotten. It seems to me that you have turned things a little upside down. It may be only the way you have formulated yourself, but to be sure: *You* don't use any indexes for joining nor order by. You write your sql statements to do the appropriate joins or ordering. Those will be executed correctly independently of any indexes. They will work even if you have created no indexes at all. The only purpose of an index is to enable the engine to use it (if it is able to) to speed up the execution of your statements. Of course in many cases your statement will not "work" without these indexes in the sense that they will take an inordinate amount of time to execute. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org