explain.depesz.com

PostgreSQL's explain analyze made readable

Result: n9q

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.108 2,017.344 ↑ 1.0 1 1

Limit (cost=294,403.90..294,403.90 rows=1 width=58) (actual time=2,017.237..2,017.344 rows=1 loops=1)

2. 84.231 2,017.236 ↑ 1,531,083.0 1 1

Sort (cost=294,403.90..298,231.61 rows=1,531,083 width=58) (actual time=2,017.236..2,017.236 rows=1 loops=1)

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

HashAggregate (cost=271,437.65..286,748.48 rows=1,531,083 width=58) (actual time=1,786.887..1,933.005 rows=563,140 loops=1)

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

Nested Loop (cost=39,010.65..259,954.53 rows=1,531,083 width=58) (actual time=158.644..1,476.721 rows=563,140 loops=1)

5. 0.000 496.069 ↑ 1.7 194,948 1

Gather (cost=39,010.65..191,113.61 rows=337,066 width=44) (actual time=158.633..496.069 rows=194,948 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
6. 107.255 1,041.317 ↑ 2.2 48,737 4

Nested Loop (cost=38,010.65..156,407.01 rows=108,731 width=44) (actual time=178.369..1,041.317 rows=48,737 loops=4)

7. 24.782 934.060 ↑ 2.2 48,737 4

Hash Join (cost=38,010.65..154,338.01 rows=108,731 width=60) (actual time=178.320..934.060 rows=48,737 loops=4)

  • Hash Cond: (f.entity_id = e.id)
8. 28.341 855.927 ↑ 2.2 48,737 4

Hash Join (cost=25,583.43..141,625.36 rows=108,731 width=76) (actual time=124.060..855.927 rows=48,737 loops=4)

  • Hash Cond: (i.file_id = f.id)
9. 661.467 705.872 ↑ 2.2 48,737 4

Nested Loop (cost=0.00..115,756.51 rows=108,731 width=52) (actual time=0.102..705.872 rows=48,737 loops=4)

10. 44.402 44.402 ↑ 1.3 219,710 4

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

11. 0.003 0.003 ↓ 0.0 0 878,838

Index Scan using invoice_id_idx on invoice i (cost=0.00..0.32 rows=1 width=48) (actual time=0.003..0.003 rows=0 loops=878,838)

  • 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
12. 38.094 121.714 ↑ 2.4 130,507 4

Hash (cost=21,687.08..21,687.08 rows=311,708 width=40) (actual time=121.714..121.714 rows=130,507 loops=4)

  • Buckets: 524288 Batches: 1 Memory Usage: 13273kB
13. 83.620 83.620 ↑ 2.4 130,507 4

Seq Scan on file f (cost=0.00..21,687.08 rows=311,708 width=40) (actual time=0.021..83.620 rows=130,507 loops=4)

14. 5.535 53.351 ↑ 5.3 19,520 4

Hash (cost=11,125.95..11,125.95 rows=104,102 width=16) (actual time=53.351..53.351 rows=19,520 loops=4)

  • Buckets: 131072 Batches: 1 Memory Usage: 1939kB
15. 47.816 47.816 ↑ 5.3 19,520 4

Index Only Scan using client_pkey on entity e (cost=0.42..11,125.95 rows=104,102 width=16) (actual time=0.098..47.816 rows=19,520 loops=4)

  • Heap Fetches: 30678
16. 0.002 0.002 ↑ 1.0 1 194,948

Index Scan using supplier_id_idx on supplier s (cost=0.00..0.02 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=194,948)

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