nette / database

💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
https://doc.nette.org/database
Other
512 stars 108 forks source link

Possibility to set USE/FORCE/IGNORE INDEX #249

Open peterpp opened 4 years ago

peterpp commented 4 years ago

I have a big table with many records (millions). For some obscure reason, SQL database keep using wrong index, so selecting few rows takes 20 seconds instead of 9 ms. It would be very helpful, if there will be a possibility to set index hints: https://dev.mysql.com/doc/refman/8.0/en/index-hints.html

For example:

SELECT * 
FROM `big_table` 
USE INDEX (my_better_index)
WHERE ...