explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5uCh : Optimization for: plan #4uBk

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.107 2,053.034 ↑ 1.0 1 1

Limit (cost=268,762.12..268,762.12 rows=1 width=58) (actual time=2,052.929..2,053.034 rows=1 loops=1)

2. 104.226 2,052.927 ↑ 1,170,701.0 1 1

Sort (cost=268,762.12..271,688.87 rows=1,170,701 width=58) (actual time=2,052.927..2,052.927 rows=1 loops=1)

  • Sort Key: f.created, l.line_position, cla.classification_label DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 491.940 1,948.701 ↑ 2.1 562,346 1

HashAggregate (cost=251,201.61..262,908.62 rows=1,170,701 width=58) (actual time=1,774.164..1,948.701 rows=562,346 loops=1)

  • Group Key: l.id, cla.classification_label, f.id
4. 43.045 1,456.761 ↑ 2.1 562,346 1

Nested Loop (cost=23,899.63..242,421.35 rows=1,170,701 width=58) (actual time=97.476..1,456.761 rows=562,346 loops=1)

5. 0.000 440.491 ↑ 1.7 194,645 1

Gather (cost=23,899.63..173,625.77 rows=336,844 width=44) (actual time=97.460..440.491 rows=194,645 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
6. 136.766 684.736 ↑ 2.2 48,661 4

Hash Join (cost=22,899.63..138,941.37 rows=108,659 width=44) (actual time=117.815..684.736 rows=48,661 loops=4)

  • Hash Cond: (i.file_id = f.id)
  • -> Hash (cost=20494.28..20494.28 rows=192428 width=24) (actual time=115.603..115.603 rows=130460 loops=4) Buckets: 262144 Batches: 1 Memory Usage: 9183kB
7. 437.822 547.970 ↑ 2.2 48,661 4

Nested Loop (cost=0.00..115,756.51 rows=108,659 width=36) (actual time=0.216..547.970 rows=48,661 loops=4)

8. 35.307 35.307 ↑ 1.3 219,634 4

Parallel Seq Scan on invoice_line l (cost=0.00..25,277.16 rows=282,916 width=36) (actual time=0.031..35.307 rows=219,634 loops=4)

9. 0.002 0.002 ↓ 0.0 0 878,535

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

  • 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
10. 74.839 74.839 ↑ 1.5 130,460 4

Seq Scan on file f (cost=0.00..20,494.28 rows=192,428 width=24) (actual time=0.036..74.839 rows=130,460 loops=4)

11. 973.225 973.225 ↑ 1.0 3 194,645

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

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