explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.087 1,993.992 ↑ 1.0 1 1

Limit (cost=254,300.70..254,300.70 rows=1 width=58) (actual time=1,993.907..1,993.992 rows=1 loops=1)

2. 87.124 1,993.905 ↑ 1,531,606.0 1 1

Sort (cost=254,300.70..258,129.72 rows=1,531,606 width=58) (actual time=1,993.905..1,993.905 rows=1 loops=1)

  • Sort Key: f.created, l.line_position, cla.classification_label DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 440.313 1,906.781 ↑ 2.7 563,140 1

HashAggregate (cost=231,326.61..246,642.67 rows=1,531,606 width=58) (actual time=1,758.023..1,906.781 rows=563,140 loops=1)

  • Group Key: l.id, cla.classification_label, f.id
4. 174.242 1,466.468 ↑ 2.7 563,140 1

Nested Loop (cost=113,120.25..219,839.57 rows=1,531,606 width=58) (actual time=247.029..1,466.468 rows=563,140 loops=1)

5. 187.928 512.434 ↑ 1.7 194,948 1

Hash Join (cost=113,120.25..150,998.24 rows=337,068 width=44) (actual time=247.019..512.434 rows=194,948 loops=1)

  • Hash Cond: (l.invoice_id = i.id)
6. 77.600 77.600 ↓ 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..77.600 rows=878,838 loops=1)

7. 13.362 246.906 ↑ 1.2 45,902 1

Hash (cost=112,455.28..112,455.28 rows=53,197 width=40) (actual time=246.906..246.906 rows=45,902 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3740kB
8. 5.165 233.544 ↑ 1.2 45,902 1

Gather (cost=1,000.00..112,455.28 rows=53,197 width=40) (actual time=0.860..233.544 rows=45,902 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
9. 26.801 228.379 ↑ 1.5 11,476 4

Nested Loop (cost=0.00..106,135.58 rows=17,160 width=40) (actual time=0.669..228.379 rows=11,476 loops=4)

10. 22.726 201.576 ↑ 1.5 11,476 4

Nested Loop (cost=0.00..105,332.44 rows=17,160 width=56) (actual time=0.610..201.576 rows=11,476 loops=4)

11. 163.154 178.848 ↑ 1.5 11,476 4

Nested Loop (cost=0.00..99,468.20 rows=17,160 width=72) (actual time=0.555..178.848 rows=11,476 loops=4)

12. 15.689 15.689 ↑ 1.3 32,627 4

Parallel Seq Scan on file f (cost=0.00..19,010.29 rows=44,029 width=40) (actual time=0.025..15.689 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.82 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.34 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.05 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=45,902)

  • Index Cond: (id = i.supplier_id)
16. 779.792 779.792 ↑ 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.002..0.004 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