Jump to content

Simple Query Optimization by Indexing


jomsfx

Recommended Posts

I have a really simple query but can't figure out how to make it faster. It's just something like:

 

SELECT field1 FROM table1 WHERE field2 = 'value'; 

 

Because of 300,000 rows in the table it takes around 50 seconds to execute.

I have been researching about indexes and tried to create an index for field2(varchar 80) with an Index Type of Normal and Index Method of BTREE, but the process is still slow.

The storage engine is InnoDB.

 

Once I solve this I will be adding other criteria in the WHERE clause using other columns within the said table.

 

If you could suggest another way to speed this up or could point me to the right direction I would really appreciate it.

 

Thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/242247-simple-query-optimization-by-indexing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.