Hacking MySQL by Lukas Vileikis

Hacking MySQL by Lukas Vileikis

Author:Lukas Vileikis
Language: eng
Format: epub
ISBN: 9798868809804
Publisher: Apress


Index to help the ORDER BY clause: If your index contains all of the columns you’re ordering by in the order you’re ordering by (i.e., INDEX(a,b) will satisfy ORDER BY a,b), the database optimizer may avoid sorting thus making SQL queries faster.

Make use of the LIMIT clause: The LIMIT clause is (unsurprisingly) used to limit the rows that are returned. For ordinary SELECTs where the LIMIT clause isn’t specified and the table is rather huge, MySQL would only return 25 rows per page and allow you to flick to other pages. In this case, returning only one row (LIMIT [any number],1) will be significantly faster no matter how much data exists in a database, and you may also want to omit the HAVING clause from a query that has the LIMIT clause to see if it runs faster. If you find yourself using LIMIT together with ORDER BY, consider using an index on the ordered columns to speed up the query too.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.