On Fri, Mar 25, 2005 at 11:45:15PM +0100, Egil Kvaleberg wrote:
Brion Vibber wrote:
How do you expect this table to be queried? Individual indexes on the lat/long fields seem like they'd be kind of awkward, since it can only really use one in a given query.
The main use is a SELECT where
$condition = "gis_latitude_max >= " . $latmin . " AND gis_latitude_min <= " . $latmax . " AND gis_longitude_max >= " . $lonmin . " AND gis_longitude_min <= " . $lonmax . " AND gis_globe = '" . $globe . "'";
So perhaps the indexes are of no use in this case? (As mentioned, I'm totally stupid wrt. databases).
Probably only the first dimension would use the index. It might or might not speed things enough.
Indexes used for multidimentional data (in gis and graphics software) are very different from unidimensional indexes found in typical rdbmses.
Some dbs (= Postgres) have 2d and multi-d indexes exactly for stuff like that. It should be much faster to use them.