"order by" in a query takes a lot of time in MySQL. SHOW PROFILES indicates that the time is being executed by the sorting process. Is there a setup / workaround that will reduce the sorting time?
If you do not have an index in the field that you order, add it:
"In some cases, MySQL may use the index to execute the ORDER BY clause without additional sorting.
Edit: (From the section on optimizing ORDER BY in the MySQL documentation.)
Adding the appropriate indexes for the fields you order should do the trick.
, (), , .
ALTER TABLE `tablename` ADD INDEX `indexname` (`columnname`);
, _ .
, , , ; , .
: show create table tbl_name " "
MySQL , , , . , , , .
Source: https://habr.com/ru/post/1712664/More articles:Преобразование объявления в javascript ActiveXObject - javascriptCreating thumbnails from swf file in php? - phpHow to check if a private method has been called with the expected argument in unit test? - c #Portable way to determine total disk size in Java (pre java 6) - javaDoes BitArray list a lot of boxing / unboxing? - performanceDisallow calling public constructors except XML serializer - c #library for sending trackbacks / pingbacks in php - trackbackПроблема с Javascript - javascriptWPF / C #: disable drag and drop for text fields? - c #exchange attributes openid - attributesAll Articles