List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:October 11 2011 8:36am
Subject:Re: Index question
View as plain text  
----- Original Message -----
> From: "Alex Schaft" <alexs@stripped>
> 
> If you have a table with columns A & B, and might do a where on A or
> B, or an order by A, B, would single column indexes on A and B suffice
> or would performance on the order by query be improved by an index on
> A,B?

Depends on usage :-)

key (a, b) is good for "where a=.." or "where a=.. and b=.."
key (b, a) is good for "where b=.." or "where b=.. and a=.."
  (note that the sequence of a and b in the where clause is not important)
key (a), key (b) is good for "where a=.." or "where b=.." but will only use one index for
"where a=.. and b=..".

I think work is ongoing on having the parser use multiple indices, but I'm not sure where
that's at.


-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel
Thread
Index questionAlex Schaft11 Oct
  • Re: Index questionJohan De Meersman11 Oct
    • Re: Index questionNeil Tompkins11 Oct
      • Re: Index questionRik Wasmus11 Oct
        • Re: Index questionAlex Schaft11 Oct
          • Re: Index questionAlex Schaft11 Oct
          • Re: Index questionRik Wasmus11 Oct
            • Re: Index questionNeil Tompkins11 Oct
              • Re: Index questionRik Wasmus11 Oct
                • Re: Index questionJohan De Meersman11 Oct
                  • Re: Index questionTompkins Neil11 Oct
                    • Re: Index questionJohan De Meersman12 Oct
  • Re: Index questionArthur Fuller11 Oct