Hi,
I'm new to databases :) I need help speeding up select queries on my
data which are currently taking 4-5 seconds. I set up a single large
table of coordinates data with an index on the fields I use most
frequently in select queries. The data is about 100MB and index is
80MB. The table has the following structure:
CREATE TABLE `ptimes` (
`id` INT UNSIGNED NOT NULL ,
`rc` CHAR ( 1 ) UNSIGNED NOT NULL ,
`lat` INT NOT NULL ,
`long` INT NOT NULL ,
`ccode` CHAR( 2 ) NOT NULL ,
`admcode` CHAR( 4 ) NOT NULL ,
`nt` CHAR( 1 ) NOT NULL ,
`name` VARCHAR( 30 ) NOT NULL ,
PRIMARY KEY ( `id` ) ,
INDEX ( `lat` , `long` , `ccode` , `admcode` , `name` )
);
The rc, nt and ccode fields' data are repeated a lot. I mostly need to
run queries to lookup lat and long fields, given rc, ccode, admcode and
name. I won't be doing many insert or updates. Disk space is not a
problem. System is RedHat Linux AS3 on Pentium 4 with 512MB.
I appreciate any help improving the table structure. Would it be
possible to speed up the queries to under .5 sec on this
hardware/software?
Thanks!
I'm new to databases :) I need help speeding up select queries on my
data which are currently taking 4-5 seconds. I set up a single large
table of coordinates data with an index on the fields I use most
frequently in select queries. The data is about 100MB and index is
80MB. The table has the following structure:
CREATE TABLE `ptimes` (
`id` INT UNSIGNED NOT NULL ,
`rc` CHAR ( 1 ) UNSIGNED NOT NULL ,
`lat` INT NOT NULL ,
`long` INT NOT NULL ,
`ccode` CHAR( 2 ) NOT NULL ,
`admcode` CHAR( 4 ) NOT NULL ,
`nt` CHAR( 1 ) NOT NULL ,
`name` VARCHAR( 30 ) NOT NULL ,
PRIMARY KEY ( `id` ) ,
INDEX ( `lat` , `long` , `ccode` , `admcode` , `name` )
);
The rc, nt and ccode fields' data are repeated a lot. I mostly need to
run queries to lookup lat and long fields, given rc, ccode, admcode and
name. I won't be doing many insert or updates. Disk space is not a
problem. System is RedHat Linux AS3 on Pentium 4 with 512MB.
I appreciate any help improving the table structure. Would it be
possible to speed up the queries to under .5 sec on this
hardware/software?
Thanks!
Comment