CrazyHacKeRs
Guest
Как анализировать результат explain?
Подскажите куда смотреть, и что видно по след. даным:
Что нужно оптимизировать?
Подскажите куда смотреть, и что видно по след. даным:
Что нужно оптимизировать?
Код:
Hash Join (cost=1579.54..6096623.52 rows=102 width=1926)
Hash Cond: ("outer".image_id = "inner".image_id)
-> Nested Loop (cost=1339.26..6096358.38 rows=86 width=1922)
-> Hash Join (cost=1339.26..6096184.72 rows=86 width=1890)
Hash Cond: ("outer".item_id = "inner".item_id)
-> Hash Join (cost=7.60..6094616.50 rows=1777 width=1882)
Hash Cond: ("outer".vendor = "inner".vendor_id)
-> Seq Scan on items i (cost=0.00..6094564.46 rows=1777 width=1058)
Filter: ((add2db > ((('now'::text)::date - '5 days'::interval))::timestamp with time zone) AND (subplan))
SubPlan
-> Materialize (cost=571.46..571.46 rows=51 width=4)
-> Subquery Scan hlp_items_with_img (cost=544.45..571.46 rows=51 width=4)
-> Unique (cost=544.45..571.46 rows=51 width=4)
-> Group (cost=544.45..570.17 rows=514 width=4)
-> Sort (cost=544.45..557.31 rows=5143 width=4)
Sort Key: img_tovary.item_id
-> Seq Scan on img_tovary (cost=0.00..227.43 rows=5143 width=4)
-> Hash (cost=7.08..7.08 rows=208 width=824)
-> Seq Scan on vendor v (cost=0.00..7.08 rows=208 width=824)
-> Hash (cost=1330.37..1330.37 rows=514 width=12)
-> Subquery Scan i (cost=1291.80..1330.37 rows=514 width=12)
-> Aggregate (cost=1291.80..1330.37 rows=514 width=12)
-> Group (cost=1291.80..1317.51 rows=5143 width=12)
-> Sort (cost=1291.80..1304.65 rows=5143 width=12)
Sort Key: t.item_id
-> Hash Join (cost=631.62..974.77 rows=5143 width=12)
Hash Cond: ("outer".image_id = "inner".image_id)
-> Seq Scan on img_tovary t (cost=0.00..227.43 rows=5143 width=8)
-> Hash (cost=620.30..620.30 rows=4530 width=4)
-> Seq Scan on img_data i (cost=0.00..620.30 rows=4530 width=4)
-> Index Scan using img_data_pkey on img_data i (cost=0.00..2.01 rows=1 width=32)
Index Cond: ("outer".image_id = i.image_id)
-> Hash (cost=227.43..227.43 rows=5143 width=4)
-> Seq Scan on img_tovary t (cost=0.00..227.43 rows=5143 width=4)