explain.depesz.com

PostgreSQL's explain analyze made readable

Result: squZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 60.643 ↓ 2.0 2 1

Sort (cost=15,590.83..15,590.83 rows=1 width=633) (actual time=60.643..60.643 rows=2 loops=1)

  • Sort Key: orders.submitted_at DESC
  • Sort Method: quicksort Memory: 25kB
2. 0.008 60.631 ↓ 2.0 2 1

Nested Loop Left Join (cost=3,206.38..15,590.82 rows=1 width=633) (actual time=28.574..60.631 rows=2 loops=1)

3. 0.000 60.615 ↓ 2.0 2 1

Nested Loop Left Join (cost=3,205.96..15,590.21 rows=1 width=67) (actual time=28.565..60.615 rows=2 loops=1)

4. 0.063 60.605 ↓ 2.0 2 1

Nested Loop Anti Join (cost=3,205.54..15,589.68 rows=1 width=67) (actual time=28.560..60.605 rows=2 loops=1)

5. 0.046 60.178 ↓ 45.5 182 1

Nested Loop Left Join (cost=3,205.12..15,587.81 rows=4 width=71) (actual time=3.676..60.178 rows=182 loops=1)

6. 0.023 59.586 ↓ 45.5 182 1

Nested Loop Left Join (cost=3,204.69..15,585.73 rows=4 width=67) (actual time=3.671..59.586 rows=182 loops=1)

  • Filter: (CASE WHEN (accounts.id IS NOT NULL) THEN 'assign_rep'::text ELSE 'link_account'::text END = 'assign_rep'::text)
  • Rows Removed by Filter: 1
7. 0.097 59.014 ↑ 4.6 183 1

Nested Loop Left Join (cost=3,204.26..14,706.42 rows=842 width=48) (actual time=3.665..59.014 rows=183 loops=1)

8. 0.148 58.551 ↑ 4.6 183 1

Nested Loop Left Join (cost=3,203.84..14,268.58 rows=842 width=48) (actual time=3.660..58.551 rows=183 loops=1)

9. 0.248 57.675 ↑ 4.4 182 1

Nested Loop (cost=3,203.42..13,725.13 rows=800 width=48) (actual time=3.652..57.675 rows=182 loops=1)

10. 0.093 57.063 ↑ 4.4 182 1

Hash Join (cost=3,203.13..13,457.47 rows=802 width=33) (actual time=3.647..57.063 rows=182 loops=1)

  • Hash Cond: (order_milestones.milestone_id = milestones.id)
11. 0.237 56.955 ↑ 11.9 202 1

Nested Loop (cost=3,193.77..13,431.07 rows=2,406 width=41) (actual time=3.627..56.955 rows=202 loops=1)

12. 0.570 55.611 ↑ 5.1 369 1

Nested Loop (cost=3,193.35..12,426.91 rows=1,889 width=37) (actual time=2.366..55.611 rows=369 loops=1)

  • Join Filter: (buyer_vendors.id = orders.buyer_vendor_id)
13. 23.199 45.889 ↓ 1.1 2,288 1

Hash Join (cost=3,192.93..10,030.57 rows=2,155 width=16) (actual time=2.028..45.889 rows=2,288 loops=1)

  • Hash Cond: (buyer_vendors_public_orders_join.id = buyer_vendors.id)
14. 20.681 20.681 ↓ 1.0 253,537 1

Seq Scan on buyer_vendors buyer_vendors_public_orders_join (cost=0.00..5,865.34 rows=253,534 width=8) (actual time=0.003..20.681 rows=253,537 loops=1)

15. 0.217 2.009 ↓ 1.1 2,288 1

Hash (cost=3,165.99..3,165.99 rows=2,155 width=8) (actual time=2.009..2.009 rows=2,288 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 122kB
16. 1.604 1.792 ↓ 1.1 2,288 1

Bitmap Heap Scan on buyer_vendors (cost=41.12..3,165.99 rows=2,155 width=8) (actual time=0.337..1.792 rows=2,288 loops=1)

  • Recheck Cond: (vendor_id = 30)
  • Heap Blocks: exact=1617
17. 0.188 0.188 ↓ 1.1 2,293 1

Bitmap Index Scan on index_buyer_vendors_on_vendor_id (cost=0.00..40.58 rows=2,155 width=0) (actual time=0.188..0.188 rows=2,293 loops=1)

  • Index Cond: (vendor_id = 30)
18. 9.152 9.152 ↓ 0.0 0 2,288

Index Scan using index_orders_on_buyer_vendor_id on orders (cost=0.42..0.92 rows=15 width=29) (actual time=0.004..0.004 rows=0 loops=2,288)

  • Index Cond: (buyer_vendor_id = buyer_vendors_public_orders_join.id)
  • Filter: ((vendor_order_id IS NULL) AND (vendor_ignored_at IS NULL))
  • Rows Removed by Filter: 2
19. 1.107 1.107 ↑ 2.0 1 369

Index Scan using index_order_milestones_on_order_id on order_milestones (cost=0.42..0.51 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=369)

  • Index Cond: (order_id = orders.id)
20. 0.002 0.015 ↑ 1.0 1 1

Hash (cost=9.34..9.34 rows=1 width=8) (actual time=0.015..0.015 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
21. 0.001 0.013 ↑ 1.0 1 1

Nested Loop (cost=0.28..9.34 rows=1 width=8) (actual time=0.012..0.013 rows=1 loops=1)

22. 0.007 0.007 ↑ 1.0 1 1

Seq Scan on milestones (cost=0.00..1.04 rows=1 width=4) (actual time=0.006..0.007 rows=1 loops=1)

  • Filter: ((name)::text = 'submitted'::text)
  • Rows Removed by Filter: 2
23. 0.005 0.005 ↑ 1.0 1 1

Index Only Scan using vendors_pkey on vendors (cost=0.28..8.29 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1)

  • Index Cond: (id = 30)
  • Heap Fetches: 1
24. 0.364 0.364 ↑ 1.0 1 182

Index Scan using buyers_pkey on buyers (cost=0.29..0.32 rows=1 width=23) (actual time=0.002..0.002 rows=1 loops=182)

  • Index Cond: (id = buyer_vendors_public_orders_join.buyer_id)
  • Filter: (NOT demo)
25. 0.728 0.728 ↑ 1.0 1 182

Index Scan using index_order_contacts_on_order_id on order_contacts (cost=0.42..0.67 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=182)

  • Index Cond: (order_id = orders.id)
  • Filter: ((party)::text = 'vendor'::text)
  • Rows Removed by Filter: 1
26. 0.366 0.366 ↑ 1.0 1 183

Index Scan using buyer_vendors_pkey on buyer_vendors buyer_vendors_public_orders_join_2 (cost=0.42..0.51 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=183)

  • Index Cond: (id = orders.buyer_vendor_id)
27. 0.549 0.549 ↑ 1.0 1 183

Index Scan using accounts_pkey on accounts (cost=0.43..1.03 rows=1 width=23) (actual time=0.002..0.003 rows=1 loops=183)

  • Index Cond: (id = buyer_vendors_public_orders_join_2.account_id)
28. 0.546 0.546 ↑ 2.0 1 182

Index Scan using index_account_assignments_on_account_id on account_assignments (cost=0.43..0.50 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=182)

  • Index Cond: (account_id = accounts.id)
29. 0.364 0.364 ↑ 1.0 1 182

Index Only Scan using users_pkey on users (cost=0.42..0.46 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=182)

  • Index Cond: (id = account_assignments.sales_rep_id)
  • Heap Fetches: 180
30. 0.010 0.010 ↑ 1.0 1 2

Index Scan using index_order_milestones_on_order_id on order_milestones submitted_order_milestones_public_orders_join (cost=0.42..0.52 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=2)

  • Index Cond: (order_id = orders.id)
  • Filter: (milestone_id = 1)
31. 0.008 0.008 ↑ 1.0 1 2

Index Scan using users_pkey on users submitters_public_orders (cost=0.42..0.59 rows=1 width=17) (actual time=0.004..0.004 rows=1 loops=2)

  • Index Cond: (id = submitted_order_milestones_public_orders_join.created_by_id)