explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4uBk

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.094 3,195.547 ↑ 1.0 1 1

Limit (cost=282,583.46..282,583.47 rows=1 width=58) (actual time=3,195.455..3,195.547 rows=1 loops=1)

2. 79.420 3,195.453 ↑ 1,471,747.0 1 1

Sort (cost=282,583.46..286,262.83 rows=1,471,747 width=58) (actual time=3,195.453..3,195.453 rows=1 loops=1)

  • Sort Key: f.created, l.line_position, cla.classification_label DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 507.632 3,116.033 ↑ 2.8 533,242 1

HashAggregate (cost=260,507.26..275,224.73 rows=1,471,747 width=58) (actual time=2,939.701..3,116.033 rows=533,242 loops=1)

  • Group Key: l.id, cla.classification_label, f.id
  • Filter: (NOT bool_or(cla.is_training))
  • Rows Removed by Filter: 29029
4. 163.785 2,608.401 ↑ 2.5 591,282 1

Nested Loop (cost=23,899.63..245,789.79 rows=1,471,747 width=59) (actual time=70.835..2,608.401 rows=591,282 loops=1)

5. 82.086 1,666.156 ↑ 1.7 194,615 1

Gather (cost=23,899.63..173,625.77 rows=336,844 width=44) (actual time=70.825..1,666.156 rows=194,615 loops=1)

  • Workers Planned: 3
  • Workers Launched: 0
  • -> Hash Join (cost=22899.63..138941.37 rows=108659 width=44) (actual time=70.399..1643.566 rows=194615 loops=1) Hash Cond: (i.file_id = f.id)
6. 1,423.368 1,514.652 ↓ 1.8 194,615 1

Nested Loop (cost=0.00..115,756.51 rows=108,659 width=36) (actual time=0.018..1,514.652 rows=194,615 loops=1)

7. 91.283 91.283 ↓ 3.1 878,505 1

Parallel Seq Scan on invoice_line l (cost=0.00..25,277.16 rows=282,916 width=36) (actual time=0.004..91.283 rows=878,505 loops=1)

8. 0.001 0.001 ↓ 0.0 0 878,505

Index Scan using invoice_id_idx on invoice i (cost=0.00..0.32 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=878,505)

  • Index Cond: (id = l.invoice_id)
  • Rows Removed by Index Recheck: 0
  • Filter: ((source_file = 'pdf'::text) AND (exported_status = 'AVAILABLE'::text))
  • Rows Removed by Filter: 1
9. 28.400 69.418 ↑ 1.5 130,437 1

Hash (cost=20,494.28..20,494.28 rows=192,428 width=24) (actual time=69.418..69.418 rows=130,437 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 9182kB
10. 41.018 41.018 ↑ 1.5 130,437 1

Seq Scan on file f (cost=0.00..20,494.28 rows=192,428 width=24) (actual time=0.005..41.018 rows=130,437 loops=1)

11. 778.460 778.460 ↑ 1.3 3 194,615

Index Scan using classification_source_id_idx1 on classification cla (cost=0.00..0.17 rows=4 width=31) (actual time=0.002..0.004 rows=3 loops=194,615)

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