explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.081 2,406.456 ↑ 1.0 1 1

Limit (cost=201,103.92..201,103.92 rows=1 width=58) (actual time=2,406.376..2,406.456 rows=1 loops=1)

2. 105.153 2,406.375 ↑ 1,115,382.0 1 1

Sort (cost=201,103.92..203,892.37 rows=1,115,382 width=58) (actual time=2,406.375..2,406.375 rows=1 loops=1)

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

HashAggregate (cost=184,373.19..195,527.01 rows=1,115,382 width=58) (actual time=2,117.067..2,301.222 rows=563,140 loops=1)

  • Group Key: l.id, cla.classification_label, f.id
4. 192.616 1,724.022 ↑ 2.0 563,140 1

Nested Loop (cost=69,288.50..176,007.82 rows=1,115,382 width=58) (actual time=208.499..1,724.022 rows=563,140 loops=1)

5. 247.085 556.666 ↑ 1.7 194,948 1

Hash Join (cost=69,288.50..107,166.49 rows=337,068 width=44) (actual time=208.488..556.666 rows=194,948 loops=1)

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

7. 12.636 208.395 ↑ 1.2 45,902 1

Hash (cost=68,623.54..68,623.54 rows=53,197 width=40) (actual time=208.395..208.395 rows=45,902 loops=1)

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

Gather (cost=1,000.41..68,623.54 rows=53,197 width=40) (actual time=0.521..195.759 rows=45,902 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
9. 37.610 183.904 ↑ 1.4 15,301 3

Nested Loop (cost=0.41..62,303.84 rows=22,165 width=40) (actual time=0.252..183.904 rows=15,301 loops=3)

10. 32.154 146.292 ↑ 1.4 15,301 3

Nested Loop (cost=0.41..61,266.43 rows=22,165 width=56) (actual time=0.193..146.292 rows=15,301 loops=3)

11. 55.595 114.136 ↑ 1.4 15,301 3

Nested Loop (cost=0.41..57,619.79 rows=22,165 width=72) (actual time=0.136..114.136 rows=15,301 loops=3)

12. 58.538 58.538 ↑ 1.4 15,301 3

Parallel Index Scan using invoice_id_file_id_idx on invoice i (cost=0.41..49,280.39 rows=22,165 width=48) (actual time=0.060..58.538 rows=15,301 loops=3)

13. 0.003 0.003 ↑ 1.0 1 45,902

Index Scan using file_id_idx on file f (cost=0.00..0.38 rows=1 width=40) (actual time=0.003..0.003 rows=1 loops=45,902)

  • Index Cond: (id = i.file_id)
  • Rows Removed by Index Recheck: 0
14. 0.002 0.002 ↑ 1.0 1 45,902

Index Scan using entity_id_idx on entity e (cost=0.00..0.16 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. 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