explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 5,733.516 ↑ 586,245.8 5 1

Finalize GroupAggregate (cost=1,782,983.85..2,174,851.95 rows=2,931,229 width=262) (actual time=5,733.503..5,733.516 rows=5 loops=1)

  • Group Key: c2.currency_code, dt2.doc_type_name, de.doc_type_id, mm.supplier_contract_id
2. 0.000 5,892.476 ↑ 407,115.0 6 1

Gather Merge (cost=1,782,983.85..2,101,571.24 rows=2,442,690 width=262) (actual time=5,733.487..5,892.476 rows=6 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 0.066 17,171.523 ↑ 610,672.5 2 3

Partial GroupAggregate (cost=1,781,983.83..1,818,624.18 rows=1,221,345 width=262) (actual time=5,723.839..5,723.841 rows=2 loops=3)

  • Group Key: c2.currency_code, dt2.doc_type_name, de.doc_type_id, mm.supplier_contract_id
4. 0.270 17,171.457 ↑ 610,672.5 2 3

Sort (cost=1,781,983.83..1,785,037.19 rows=1,221,345 width=237) (actual time=5,723.819..5,723.819 rows=2 loops=3)

  • Sort Key: c2.currency_code, dt2.doc_type_name, de.doc_type_id, mm.supplier_contract_id
  • Sort Method: quicksort Memory: 25kB
5. 0.168 17,171.187 ↑ 610,672.5 2 3

Hash Join (cost=65.19..1,577,817.61 rows=1,221,345 width=237) (actual time=3,256.231..5,723.729 rows=2 loops=3)

  • Hash Cond: (de.doc_type_id = dt2.doc_type_id)
6. 0.063 17,170.749 ↑ 610,672.5 2 3

Hash Join (cost=63.67..1,561,022.60 rows=1,221,345 width=19) (actual time=3,256.087..5,723.583 rows=2 loops=3)

  • Hash Cond: (mm.currency_id = c2.currency_id)
7. 0.039 17,170.614 ↑ 610,672.5 2 3

Nested Loop (cost=2.82..1,557,749.71 rows=1,221,345 width=19) (actual time=3,256.046..5,723.538 rows=2 loops=3)

8. 5,428.170 17,170.413 ↑ 610,903.5 2 3

Hash Join (cost=2.25..829,806.23 rows=1,221,807 width=19) (actual time=3,256.009..5,723.471 rows=2 loops=3)

  • Hash Cond: (mm.supplier_contract_id = l.supplier_contract_id)
9. 11,742.105 11,742.105 ↑ 1.3 15,907,473 3

Parallel Seq Scan on money_movement mm (cost=0.00..742,948.80 rows=19,903,229 width=19) (actual time=0.048..3,914.035 rows=15,907,473 loops=3)

  • Filter: (dt < '2020-01-02 00:00:00'::timestamp without time zone)
10. 0.021 0.138 ↑ 25.0 4 3

Hash (cost=1.00..1.00 rows=100 width=4) (actual time=0.046..0.046 rows=4 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
11. 0.117 0.117 ↑ 25.0 4 3

Function Scan on jsonb_to_recordset l (cost=0.00..1.00 rows=100 width=4) (actual time=0.038..0.039 rows=4 loops=3)

12. 0.162 0.162 ↑ 1.0 1 6

Index Scan using ix_document_edition_doc_edit_id on document_edition de (cost=0.56..0.60 rows=1 width=8) (actual time=0.027..0.027 rows=1 loops=6)

  • Index Cond: (doc_edit_id = mm.doc_edit_id)
13. 0.020 0.072 ↑ 188.3 12 2

Hash (cost=32.60..32.60 rows=2,260 width=8) (actual time=0.036..0.036 rows=12 loops=2)

  • Buckets: 4096 Batches: 1 Memory Usage: 33kB
14. 0.052 0.052 ↑ 188.3 12 2

Seq Scan on currency c2 (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.024..0.026 rows=12 loops=2)

15. 0.090 0.270 ↑ 1.0 23 3

Hash (cost=1.23..1.23 rows=23 width=222) (actual time=0.090..0.090 rows=23 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
16. 0.180 0.180 ↑ 1.0 23 3

Seq Scan on document_type dt2 (cost=0.00..1.23 rows=23 width=222) (actual time=0.051..0.060 rows=23 loops=3)