Re: GEO Search with large table is very slow
Thanks Rick,
I believe that I have setup compound indexes. This is when you have multiple columns in a single index, correct?
I have a couple of questions about the way MySQL uses an index with multiple columns. Does it matter how the columns are ordered in the WHERE clause of the SQL statement? For instance, if my indexes is setup like "beds, baths, city", and my WHERE cluase is like "city = 1 AND baths = 2 AND beds = 2" will all of the columns still be used?
I thought that using "IN" was not a range. If it is a range, that is part of the problem because I use beds and baths in the very beginning of the SQL statement. Would it be better to use "beds = 1 OR beds = 2 OR beds = 3" rather than "beds IN(1,2,3)"?
When you have a compound index on multiple columns, it seems that there is a limit to the number of columns you can add. Since latitude and longitude are almost always unique (some properties don't have them), the unique combination of all columns can't be more than the number of rows in the table. Is this correct? In phpMyAdmin, the rows of an index is never bigger than the rows of the table.
Is there anyway to keep the table out of memory so I can see the real speed of the query? Or should I increase the memory buffer so that MySQL stores more in memory to speed things up. My guess is that I would have to increase the memory by a lot to satisfy all of the unique queries.
-Sean