I've created a table with several indexes as follows: $query = "CREATE TABLE `data_raw` ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, run_id VARCHAR(20) DEFAULT 'error_internal' NOT NULL, time_run DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, ...clip. PRIMARY KEY (id), INDEX x_run_id (run_id), INDEX x_comp_code (comp_code), INDEX x_time_run (time_run), INDEX x_url (url) ) COMMENT = 'Raw data samples' ";
$query executed with php mysql_query. The table is created OK. I add many records to the table with $query = "INSERT INTO data_raw( id, run_id, time_run, time_sample, comp_code, url, url_index, err_number, err_desc, err_src ) VALUES( 0, '$run_id', '$time_run', '$ts', '$data[1]', '$data[2]', $data[3], $data[4], '$data[5]', '$data[6]' )"; Data is added OK. But, the indexes are not updated! Running myPHPAdmin shows: Indexes: Documentation Keyname Type Cardinality Action Field PRIMARY PRIMARY 12932 Edit Drop id x_run_id INDEX None Edit Drop run_id x_comp_code INDEX None Edit Drop comp_code x_time_run INDEX None Edit Drop time_run x_url INDEX None Edit Drop url Access is slow. If I do an "ALTER TABLE ... ADD INDEX ..." indexes are updated and subsequent INSERTS update the indexes. I'm sure I'm doing something simple wrong but need a clue as to what? Any help much appreciated.