Just to clarify having key indexes of (a,b) or (b,a) have no difference ?

On 11 Oct 2011, at 09:36, Johan De Meersman <vegiv...@tuxera.be> wrote:

> ----- Original Message -----
>> From: "Alex Schaft" <al...@quicksoftware.co.za>
>> 
>> 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
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=neil.tompk...@googlemail.com
> 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to