RSS
 

сортировка

warning: Creating default object from empty value in /usr/local/www/jail4/kostya.in.ua/public_html/modules/taxonomy/taxonomy.pages.inc on line 34.

MySQL индексы и ORDER BY

После установки одного из модулей Друпала, выдался вот такой запрос:

SELECT node.nid AS nid,
family_individual.lastname AS family_individual_lastname,
family_individual.firstname AS family_individual_firstname,
family_individual.middlename AS family_individual_middlename,
family_individual.gender AS family_individual_gender,
family_individual.birthdate AS family_individual_birthdate,
family_individual.deathdate AS family_individual_deathdate
FROM dru_node node
LEFT JOIN dru_family_individual family_individual
ON node.nid = family_individual.nid

MySQL - неочевидная неприменимость индексов при сортировках

Using Index to Sort Data Another great benefit of BTREE index is – it allows to retrieve data in sorted form hence avoiding external sort process for executing of queries which require sorting. Using index for sorting often comes together with using index to find rows, however it can also be used just for sort for example if you’re just using ORDER BY without and where clauses on the table . In such case you would see “ Index ” type in explain which correspond to scanning (potentially) complete table in the index order.