In this instance would you create four indexes key(a) key(b) key(a,b) key (b,a) ? Or is
the decision based on the query response time ?
On 11 Oct 2011, at 13:40, Rik Wasmus <rik@stripped> wrote:
>> Next question. If you have the two separate indexes and then do two
>> queries, one for a and one for b. If you then get a list of unique id's
>> of both, would it be faster to create an intersection yourself rather
>> than have the server do the legwork?
>
> If you only have 2 unrelated indexes on a & b, it depends on the data, the
> distribution of values, etc. No single answer here, test with your data and
> you'll have the results.
>
> If you need it often, I'd go for the combined index & let MySQL do the work,
> which is probably fastest.
> --
> Rik Wasmus
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1
>