From: Neil Tompkins Date: October 11 2011 1:00pm Subject: Re: Index question List-Archive: http://lists.mysql.com/mysql/226010 Message-Id: <345A4C5C-1107-4F31-96A8-08A7935C445C@googlemail.com> MIME-Version: 1.0 (iPhone Mail 8L1) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable 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 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? >=20 > If you only have 2 unrelated indexes on a & b, it depends on the data, the= =20 > distribution of values, etc. No single answer here, test with your data an= d=20 > you'll have the results. >=20 > If you need it often, I'd go for the combined index & let MySQL do the wor= k,=20 > which is probably fastest.=20 > --=20 > Rik Wasmus >=20 > --=20 > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dneil.tompkins@goog= lemail.com >=20