explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Chmt : CAL2 question 10

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────Unique (cost=1,174,666.35..1,182,177.57 rows=1,001,496 width=36) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=1,174,666.35..1,177,170.09 rows=1,001,496 width=36) (actual rows= loops=)

  • Sort Key: staff.id, staff.first_name
3. 0.000 0.000 ↓ 0.0

Append (cost=968,015.93..1,020,073.62 rows=1,001,496 width=36) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Unique (cost=968,015.93..978,830.86 rows=1,000,000 width=17) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Sort (cost=968,015.93..971,620.90 rows=1,441,991 width=17) (actual rows= loops=)

  • Sort Key: staff.id, staff.first_name
6. 0.000 0.000 ↓ 0.0

Gather (cost=136,054.18..761,352.91 rows=1,441,991 width=17) (actual rows= loops=)

  • Workers Planned: 2
7. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=135,054.18..616,153.81 rows=600,830 width=17) (actual rows= loops=)

  • Hash Cond: (invoices.employee_id = staff.id)
8. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=111,873.17..584,259.62 rows=600,830 width=4) (actual rows= loops=)

  • Hash Cond: (invoice_items.product_code = products.code)
9. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=93,865.45..548,705.62 rows=1,149,053 width=19) (actual rows= loops=)

  • Hash Cond: (invoice_items.invoice_number = invoices.number)
10. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on invoice_items (cost=0.00..289,695.87 rows=11,456,487 width=19) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=90,443.55..90,443.55 rows=208,552 width=8) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on invoices (cost=0.00..90,443.55 rows=208,552 width=8) (actual rows= loops=)

  • Filter: (date > (now() - '4 mons'::interval))
13. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=14,220.33..14,220.33 rows=217,871 width=15) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on products (cost=0.00..14,220.33 rows=217,871 width=15) (actual rows= loops=)

  • Filter: (price > 500)
15. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=15,530.67..15,530.67 rows=416,667 width=17) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on staff (cost=0.00..15,530.67 rows=416,667 width=17) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Unique (cost=26,209.10..26,220.32 rows=1,496 width=17) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Sort (cost=26,209.10..26,212.84 rows=1,496 width=17) (actual rows= loops=)

  • Sort Key: staff_1.id, staff_1.first_name
19. 0.000 0.000 ↓ 0.0

Gather (cost=7,585.35..26,130.21 rows=1,496 width=17) (actual rows= loops=)

  • Workers Planned: 2
20. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=6,585.35..24,980.61 rows=623 width=17) (actual rows= loops=)

  • Hash Cond: (staff_1.store = stores.id)
21. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on staff staff_1 (cost=0.00..17,614.00 rows=207,364 width=21) (actual rows= loops=)

  • Filter: ((salary >= 3000) AND (salary <= 5000))
22. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=6,580.95..6,580.95 rows=352 width=8) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Nested Loop (cost=287.23..6,580.95 rows=352 width=8) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Nested Loop (cost=286.81..5,609.37 rows=559 width=23) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Hash Join (cost=286.24..4,069.16 rows=11 width=4) (actual rows= loops=)

  • Hash Cond: ((stores.city = sp_cities.name) AND (sp_provinces.id = sp_cities.province))
26. 0.000 0.000 ↓ 0.0

Hash Join (cost=22.34..3,799.61 rows=554 width=21) (actual rows= loops=)

  • Hash Cond: (stores.province = sp_provinces.name)
27. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on stores (cost=0.00..3,313.47 rows=117,647 width=25) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Hash (cost=22.33..22.33 rows=1 width=12) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Hash Join (cost=20.68..22.33 rows=1 width=12) (actual rows= loops=)

  • Hash Cond: (sp_provinces.community = sp_autonomous_communities.id)
30. 0.000 0.000 ↓ 0.0

Seq Scan on sp_provinces (cost=0.00..1.52 rows=52 width=16) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Hash (cost=20.62..20.62 rows=4 width=4) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Seq Scan on sp_autonomous_communities (cost=0.00..20.62 rows=4 width=4) (actual rows= loops=)

  • Filter: (name = 'Comunidad de Madrid'::text)
33. 0.000 0.000 ↓ 0.0

Hash (cost=142.16..142.16 rows=8,116 width=17) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Seq Scan on sp_cities (cost=0.00..142.16 rows=8,116 width=17) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Index Scan using shops_stock_pk on stock_stores (cost=0.56..139.29 rows=73 width=19) (actual rows= loops=)

  • Index Cond: (store = stores.id)
  • Filter: (quantity > 100)
36. 0.000 0.000 ↓ 0.0

Index Scan using products_pk on products products_1 (cost=0.42..1.74 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (code = stock_stores.product)
  • Filter: (price > 400)