explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1CNe

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 909.974 ↑ 1.0 1 1

Finalize Aggregate (cost=30,667.49..30,667.50 rows=1 width=8) (actual time=909.974..909.974 rows=1 loops=1)

2. 9.032 909.965 ↓ 1.5 3 1

Gather (cost=30,667.27..30,667.48 rows=2 width=8) (actual time=909.912..909.965 rows=3 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 14.921 900.933 ↑ 1.0 1 3

Partial Aggregate (cost=29,667.27..29,667.28 rows=1 width=8) (actual time=900.933..900.933 rows=1 loops=3)

4. 545.354 886.012 ↓ 56,182.5 112,365 3

Nested Loop (cost=0.86..29,667.27 rows=2 width=4) (actual time=0.291..886.012 rows=112,365 loops=3)

  • Join Filter: ((deal.id = deal_row.deal_id) AND ((deal.type = 'CUSTOMER'::text) OR ((deal_row.quantity > '0'::numeric) AND (deal.receiver_office_id = 8)) OR ((deal_row.quantity <= '0'::numeric) AND (deal.sender_office_id = 8))))
  • Rows Removed by Join Filter: 44502
5. 220.323 340.647 ↓ 397.5 39,752 3

Nested Loop (cost=0.43..28,892.38 rows=100 width=48) (actual time=0.148..340.647 rows=39,752 loops=3)

6. 120.319 120.319 ↓ 397.5 39,752 3

Parallel Seq Scan on deal (cost=0.00..28,066.21 rows=100 width=44) (actual time=0.064..120.319 rows=39,752 loops=3)

  • Filter: (((type = 'CUSTOMER'::text) OR (receiver_office_id = 8) OR (sender_office_id = 8)) AND ((office_id = 8) OR ((type <> 'AGENT'::text) AND (sender_office_id = 8)) OR ((type <> 'AGENT'::text) AND (receiver_office_id = 8))))
  • Rows Removed by Filter: 321027
7. 0.005 0.005 ↑ 1.0 1 119,257

Index Only Scan using deal_state_pkey on deal_state (cost=0.43..8.26 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=119,257)

  • Index Cond: (deal_id = deal.id)
  • Heap Fetches: 43007
8. 0.011 0.011 ↑ 37.0 4 119,257

Index Scan using deal_row_deal_id_product_article_type_quantity_index on deal_row (cost=0.43..4.05 rows=148 width=72) (actual time=0.008..0.011 rows=4 loops=119,257)

  • Index Cond: ((deal_id = deal_state.deal_id) AND (product_article_type = ANY ('{PRODUCT,CURRENCY}'::text[])))