explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4BI6 : Optimization for: Optimization for: plan #EE8W; plan #aohP

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.019 7,169.245 ↑ 4.0 1 1

Sort (cost=680,047.65..680,047.66 rows=4 width=285) (actual time=7,169.245..7,169.245 rows=1 loops=1)

  • Sort Key: mm.dt
  • Sort Method: quicksort Memory: 25kB
2. 0.020 7,169.226 ↑ 4.0 1 1

HashAggregate (cost=680,047.57..680,047.61 rows=4 width=285) (actual time=7,169.226..7,169.226 rows=1 loops=1)

  • Group Key: de2.doc_id, de2.doc_type_id, dt.doc_type_name, mm.amount, mm.currency_id, mm.rate, mm.direction, mm.dt, mm.supplier_contract_id
3. 0.002 7,169.206 ↑ 4.0 1 1

Append (cost=1,001.13..680,047.48 rows=4 width=285) (actual time=7,169.194..7,169.206 rows=1 loops=1)

4. 0.001 7,169.006 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,001.13..680,026.84 rows=2 width=257) (actual time=7,169.006..7,169.006 rows=0 loops=1)

  • Join Filter: (dt.doc_type_id = de2.doc_type_id)
5. 0.001 7,169.005 ↓ 0.0 0 1

Nested Loop (cost=1,001.13..680,009.64 rows=1 width=39) (actual time=7,169.005..7,169.005 rows=0 loops=1)

  • Join Filter: (de2.doc_edit_id = de.ref_doc_edit_id)
6. 0.000 7,169.004 ↓ 0.0 0 1

Nested Loop (cost=1,000.57..680,009.03 rows=1 width=47) (actual time=7,169.004..7,169.004 rows=0 loops=1)

7. 310.814 7,464.185 ↓ 0.0 0 1

Gather (cost=1,000.00..680,006.24 rows=1 width=16) (actual time=7,169.002..7,464.185 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
8. 7,153.371 7,153.371 ↓ 0.0 0 3

Parallel Seq Scan on document_edition de2 (cost=0.00..679,006.14 rows=1 width=16) (actual time=7,153.371..7,153.371 rows=0 loops=3)

  • Filter: ((storno_status_id = ANY ('{2,4}'::integer[])) AND (doc_id = 21751))
  • Rows Removed by Filter: 14352475
9. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_money_movement_doc_edit_id on money_movement mm (cost=0.56..2.78 rows=1 width=31) (never executed)

  • Index Cond: (doc_edit_id = de2.doc_edit_id)
10. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ix_document_edition_ref_doc_edit_id on document_edition de (cost=0.56..0.60 rows=1 width=8) (never executed)

  • Index Cond: (ref_doc_edit_id = mm.doc_edit_id)
  • Heap Fetches: 0
11. 0.000 0.000 ↓ 0.0 0

Seq Scan on document_type dt (cost=0.00..13.20 rows=320 width=222) (never executed)

12. 0.050 0.198 ↑ 2.0 1 1

Hash Right Join (cost=6.18..20.60 rows=2 width=257) (actual time=0.186..0.198 rows=1 loops=1)

  • Hash Cond: (dt_1.doc_type_id = cde.doc_type_id)
13. 0.019 0.019 ↑ 13.9 23 1

Seq Scan on document_type dt_1 (cost=0.00..13.20 rows=320 width=222) (actual time=0.015..0.019 rows=23 loops=1)

14. 0.006 0.129 ↑ 1.0 1 1

Hash (cost=6.17..6.17 rows=1 width=39) (actual time=0.129..0.129 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
15. 0.006 0.123 ↑ 1.0 1 1

Nested Loop (cost=1.69..6.17 rows=1 width=39) (actual time=0.120..0.123 rows=1 loops=1)

16. 0.008 0.078 ↑ 1.0 1 1

Nested Loop (cost=1.13..5.57 rows=1 width=24) (actual time=0.077..0.078 rows=1 loops=1)

17. 0.043 0.043 ↑ 1.0 1 1

Index Scan using uq_current_document_edition_doc_id_doc_type_id on current_document_edition cde (cost=0.56..2.78 rows=1 width=20) (actual time=0.042..0.043 rows=1 loops=1)

  • Index Cond: (doc_id = 21751)
18. 0.027 0.027 ↑ 1.0 1 1

Index Only Scan using ix_document_edition_doc_edit_id on document_edition de_1 (cost=0.56..2.78 rows=1 width=4) (actual time=0.026..0.027 rows=1 loops=1)

  • Index Cond: (doc_edit_id = cde.doc_edit_id)
  • Heap Fetches: 1
19. 0.039 0.039 ↑ 1.0 1 1

Index Scan using idx_money_movement_doc_edit_id on money_movement mm_1 (cost=0.56..0.60 rows=1 width=31) (actual time=0.037..0.039 rows=1 loops=1)

  • Index Cond: (doc_edit_id = de_1.doc_edit_id)