There are about 1 million records. Query is needed for the pagination system.
The query looks like this:
SELECT field1, field2, field3 FROM table
WHERE field4 = '$value'
ORDER BY field5 ASC limit $offset, 30;
There are indices on field4 and field5.
I heard that:
making another table (table 6) that is an indexed hash of table4?
Searching numbers instead of text is going to be a lot faster so the query is something like:
SELECT field1, field2, field3 Force
Index(Table6) FROM table WHERE field 6
= '$hashvalue' AND field4 = '$value' ORDER BY field5 ASC limit $offset, 30;
It should help to eliminate 99.99% of data before it has to text search and should speed up your queries regardless of the offset.
How exactly should I implement it? Could you please help me understand the idea of hash tables in this example?
index(field4, field5)orindex(field4) index(field5)?EXPLAINand see if the query execution plan is different