исправил практику 'EXPLAIN и EXPLAIN ANALYZE'
This commit is contained in:
+2
-2
@@ -124,8 +124,8 @@ JOIN orders o ON u.id = o.user_id
|
|||||||
JOIN order_items oi ON o.id = oi.order_id
|
JOIN order_items oi ON o.id = oi.order_id
|
||||||
JOIN products p ON oi.product_id = p.id
|
JOIN products p ON oi.product_id = p.id
|
||||||
WHERE u.country = 'RU' AND p.category = 'Электроника';
|
WHERE u.country = 'RU' AND p.category = 'Электроника';
|
||||||
-- Порядок чтения таблиц: order_items -> products -> orders -> users
|
-- Порядок чтения таблиц: products -> order_items -> orders -> users
|
||||||
-- Количество строк: order_items - 12, products - 3, orders - 1, users - 0
|
-- Количество строк: products - 3, order_items - 12, orders - 1, users - 0
|
||||||
-- Если у country и category будут индексы, то запрос ьудет выполняться побыстре, потому что будет Index Scan, а не Seq Scan
|
-- Если у country и category будут индексы, то запрос ьудет выполняться побыстре, потому что будет Index Scan, а не Seq Scan
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user