I have more than 420,000 rows articles in my table. I just want to query a data which is has only one row, but it takes too long.. any suggestion?

database : mysql, Storage engine : MyISAM

mysql_query("SELECT id, title, ... ,postdate FROM table_name WHERE id = 1

the result only one row.. but it take too long to open the page that query on more than 420,000 rows table

Recommended Answers

All 5 Replies

do you have index on id column ?

yup, i have it

Post the output of

EXPLAIN SELECT id, title, ... ,postdate FROM table_name WHERE id = 1

Post the output of

EXPLAIN SELECT id, title, ... ,postdate FROM table_name WHERE id = 1

Everything is work, the output work good. But the problem is it take a long time to open the page.

This is the same problem when i work with 1,000,000 rows. it take a long long time to open the page. Is there any explanation about this? do i need to use a cache in the query?

Post the output of EXPLAIN so that I can identify the problem. Also post the table structure preferably the out put of

SHOW CREATE TABLE table_name;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.