I have a very simple table with two columns, but has 4.5M rows.
CREATE TABLE `content_link` (
`category_id` mediumint(8) unsigned NOT NULL,
`content_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`content_id`,`category_id`),
KEY `content_id` (`content_id`,`category_id`)
) ENGINE=MyISAM;
When I run a simple query, for example:
SELECT
*
FROM
content_link
WHERE
category_id = '11';
mysql starts the processor and takes 2-5 seconds before returning about 10 rows. The data is distributed very evenly throughout the table, and I get access to the indexed fields (I also analyzed / optimized the table, and I never change the contents of the table), so what reason is the request takes so long?
Edit: It seems that navicat was lying to me, and my primary key was not actually entered in the correct order, as it showed me the table.
source
share