Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
EXPLAIN SELECT * FROM categories\G
EXPLAIN SELECT * FROM categories\G
EXPLAIN SELECT * FROM
orderdetails d
INNER JOIN orders o ON d.orderNumber = o.orderNumber
INNER JOIN products p ON p.productCode = d.productCode
INNER JOIN productlines l ON p.productLine = l.productLine
INNER JOIN customers c on c.customerNumber = o.customerNumber
WHERE o.orderNumber = 10101
EXPLAIN SELECT * FROM categories
********************** 1. row **********************
id: 1
select_type: SIMPLE
table: categories
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 4
Extra:
1 row in set (0.00 sec)
SELECT table1.field1, table1.field2, table1.field3 FROM table1 INNER JOIN table2 ON (table1.field4 = table2.field1)
WHERE table1.field5 IN (?, ?, ?) AND table1.field6 NOT LIKE 'Europe/%' ANВ table1.field7 = ?
ORDER BY table1.field1
LIMIT ?, ?
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
LEFT JOIN wp_postmeta
ON (wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = 'layf_exclude_from_feed')
LEFT JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)
LEFT JOIN wp_icl_translations wpml_translations ON wp_posts.ID = wpml_translations.element_id AND
wpml_translations.element_type =
CONCAT('post_', wp_posts.post_type)
WHERE 1 = 1
AND (wp_posts.post_date > '2019-09-02 23:59:59')
AND (wp_postmeta.post_id IS NULL OR (mt1.meta_key = 'layf_exclude_from_feed' AND mt1.meta_value != '1'))
AND wp_posts.post_type IN ('property', 'post')
AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'expired')
AND (((wpml_translations.language_code = 'ru' OR 0) AND
wp_posts.post_type IN ('post', 'page', 'attachment', 'wp_block', 'property', 'service')) OR
wp_posts.post_type NOT IN ('post', 'page', 'attachment', 'wp_block', 'property', 'service'))
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC
LIMIT 0, 300;
Using where; Using index; Using temporary; Using filesort
Использование EXPLAIN. Улучшение запросов