explain.depesz.com

PostgreSQL's explain analyze made readable

Result: L8QR : Optimization for: Optimization for: Optimization for: plan #n9q; plan #YUT6; plan #Th9p

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.089 2,268.651 ↑ 1.0 1 1

Limit (cost=264,195.91..264,195.91 rows=1 width=58) (actual time=2,268.564..2,268.651 rows=1 loops=1)

2. 91.068 2,268.562 ↑ 946,566.0 1 1

Sort (cost=264,195.91..266,562.32 rows=946,566 width=58) (actual time=2,268.562..2,268.562 rows=1 loops=1)

  • Sort Key: f.created, l.line_position, cla.classification_label DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 527.257 2,177.494 ↑ 1.7 563,140 1

HashAggregate (cost=249,997.42..259,463.08 rows=946,566 width=58) (actual time=2,018.734..2,177.494 rows=563,140 loops=1)

  • Group Key: l.id, cla.classification_label, f.id
4. 116.443 1,650.237 ↑ 1.7 563,140 1

Nested Loop (cost=136,179.28..242,898.17 rows=946,566 width=58) (actual time=255.626..1,650.237 rows=563,140 loops=1)

5. 213.010 559.054 ↑ 1.7 194,948 1

Hash Join (cost=136,179.28..174,057.25 rows=337,066 width=44) (actual time=255.609..559.054 rows=194,948 loops=1)

  • Hash Cond: (l.invoice_id = i.id)
6. 90.642 90.642 ↓ 1.0 878,838 1

Seq Scan on invoice_line l (cost=0.00..31,218.41 rows=877,041 width=36) (actual time=0.013..90.642 rows=878,838 loops=1)

7. 13.766 255.402 ↑ 2.7 45,902 1

Hash (cost=134,645.82..134,645.82 rows=122,677 width=40) (actual time=255.402..255.402 rows=45,902 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 4252kB
8. 8.703 241.636 ↑ 2.7 45,902 1

Gather (cost=1,000.00..134,645.82 rows=122,677 width=40) (actual time=0.857..241.636 rows=45,902 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
9. 26.579 232.933 ↑ 3.4 11,476 4

Nested Loop (cost=0.00..121,378.12 rows=39,573 width=40) (actual time=0.575..232.933 rows=11,476 loops=4)

10. 22.672 206.352 ↑ 3.4 11,476 4

Nested Loop (cost=0.00..120,182.75 rows=39,573 width=56) (actual time=0.519..206.352 rows=11,476 loops=4)

11. 168.009 183.678 ↑ 3.4 11,476 4

Nested Loop (cost=0.00..113,212.41 rows=39,573 width=72) (actual time=0.464..183.678 rows=11,476 loops=4)

12. 15.664 15.664 ↑ 2.8 32,627 4

Parallel Seq Scan on file f (cost=0.00..19,469.89 rows=89,989 width=40) (actual time=0.022..15.664 rows=32,627 loops=4)

13. 0.005 0.005 ↓ 0.0 0 130,507

Index Scan using invoice_file_id_idx on invoice i (cost=0.00..1.03 rows=1 width=48) (actual time=0.004..0.005 rows=0 loops=130,507)

  • Index Cond: (file_id = f.id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((source_file = 'pdf'::text) AND (exported_status = 'AVAILABLE'::text))
  • Rows Removed by Filter: 1
14. 0.002 0.002 ↑ 1.0 1 45,902

Index Scan using entity_id_idx on entity e (cost=0.00..0.18 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=45,902)

  • Index Cond: (id = f.entity_id)
15. 0.002 0.002 ↑ 1.0 1 45,902

Index Scan using supplier_id_idx on supplier s (cost=0.00..0.03 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=45,902)

  • Index Cond: (id = i.supplier_id)
16. 974.740 974.740 ↑ 1.0 3 194,948

Index Scan using classification_source_id_idx1 on classification cla (cost=0.00..0.17 rows=3 width=30) (actual time=0.003..0.005 rows=3 loops=194,948)

  • Index Cond: (source_id = l.id)
  • Rows Removed by Index Recheck: 0
  • Filter: (NOT is_training)
  • Rows Removed by Filter: 0