Brion Vibber wrote:
CREATE TABLE wikipedia_gis ( gis_id int(8) unsigned NOT NULL, gis_latitude_min real NOT NULL, gis_latitude_max real NOT NULL, gis_longitude_min real NOT NULL, gis_longitude_max real NOT NULL, gis_globe char(12) binary, gis_type char(12) binary, gis_type_arg char(12) binary,
KEY gis_id (gis_id), INDEX gis_latitude_min (gis_latitude_min), INDEX gis_latitude_max (gis_latitude_max), INDEX gis_longitude_min (gis_longitude_min), INDEX gis_longitude_max (gis_longitude_max)
);
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).
Sometimes there is also a condition for gis_type added.
Don't call it gis_id, however; under our naming conventions that would be the name of a unique record ID within the gis table. gis_page would be better.
Will do.
Egil