explain.depesz.com

PostgreSQL's explain analyze made readable

Result: P1Am

Settings
# exclusive inclusive rows x rows loops node
1. 43.503 1,408.227 ↓ 147.2 350,083 1

Unique (cost=40,332.86..40,344.75 rows=2,379 width=96) (actual time=1,311.555..1,408.227 rows=350,083 loops=1)

2. 197.354 1,364.724 ↓ 164.0 390,064 1

Sort (cost=40,332.86..40,338.80 rows=2,379 width=96) (actual time=1,311.555..1,364.724 rows=390,064 loops=1)

  • Sort Key: p.id, p.start_date_time, ps.end_date_time, p.uuid
  • Sort Method: external merge Disk: 40712kB
3. 79.554 1,167.370 ↓ 164.0 390,064 1

Gather (cost=25,433.03..40,199.44 rows=2,379 width=96) (actual time=1,052.310..1,167.370 rows=390,064 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 203.538 1,087.816 ↓ 131.2 130,021 3

Parallel Hash Join (cost=24,433.03..38,961.54 rows=991 width=96) (actual time=1,020.220..1,087.816 rows=130,021 loops=3)

  • Hash Cond: (ps.procedure_id = p.id)
5. 25.082 25.082 ↑ 1.3 153,512 3

Parallel Seq Scan on procedure_step ps (cost=0.00..13,803.04 rows=191,904 width=16) (actual time=0.039..25.082 rows=153,512 loops=3)

6. 115.559 859.196 ↓ 92.9 130,021 3

Parallel Hash (cost=24,415.54..24,415.54 rows=1,399 width=96) (actual time=859.196..859.196 rows=130,021 loops=3)

  • Buckets: 32768 (originally 4096) Batches: 16 (originally 1) Memory Usage: 3488kB
7. 356.607 743.637 ↓ 92.9 130,021 3

Nested Loop (cost=17,029.26..24,415.54 rows=1,399 width=96) (actual time=327.725..743.637 rows=130,021 loops=3)

8. 91.849 387.028 ↓ 91.6 130,167 3

Parallel Hash Join (cost=17,028.84..23,551.99 rows=1,421 width=16) (actual time=327.665..387.028 rows=130,167 loops=3)

  • Hash Cond: (lip.line_item_id = li.id)
9. 14.843 14.843 ↑ 1.8 160,988 3

Parallel Seq Scan on line_item_procedure lip (cost=0.00..5,451.89 rows=284,089 width=16) (actual time=0.017..14.843 rows=160,988 loops=3)

10. 38.382 280.336 ↓ 128.6 130,923 3

Parallel Hash (cost=17,016.11..17,016.11 rows=1,018 width=8) (actual time=280.336..280.336 rows=130,923 loops=3)

  • Buckets: 65536 (originally 4096) Batches: 8 (originally 1) Memory Usage: 2496kB
11. 142.872 241.954 ↓ 128.6 130,923 3

Parallel Hash Join (cost=5,764.20..17,016.11 rows=1,018 width=8) (actual time=191.614..241.954 rows=130,923 loops=3)

  • Hash Cond: (li.invoice_id = inv.id)
12. 21.545 21.545 ↑ 1.2 162,786 3

Parallel Seq Scan on line_item li (cost=0.00..10,717.78 rows=203,478 width=16) (actual time=0.049..21.545 rows=162,786 loops=3)

13. 30.754 77.537 ↓ 86.8 105,072 3

Parallel Hash (cost=5,749.06..5,749.06 rows=1,211 width=8) (actual time=77.537..77.537 rows=105,072 loops=3)

  • Buckets: 65536 (originally 4096) Batches: 8 (originally 1) Memory Usage: 2144kB
14. 32.412 46.783 ↓ 86.8 105,072 3

Parallel Bitmap Heap Scan on invoice inv (cost=40.37..5,749.06 rows=1,211 width=8) (actual time=5.424..46.783 rows=105,072 loops=3)

  • Recheck Cond: (debtor_id = 1)
  • Heap Blocks: exact=8832
15. 14.371 14.371 ↓ 153.2 315,222 1

Bitmap Index Scan on idx_invoice_debtor_id (cost=0.00..39.86 rows=2,058 width=0) (actual time=14.371..14.371 rows=315,222 loops=1)

  • Index Cond: (debtor_id = 1)
16. 0.002 0.002 ↑ 1.0 1 390,502

Index Scan using procedure__pkey on procedure_ p (cost=0.42..0.61 rows=1 width=80) (actual time=0.002..0.002 rows=1 loops=390,502)

  • Index Cond: (id = lip.procedure_id)
  • Filter: (status <> ALL ('{D,DNA,CA}'::text[]))
  • Rows Removed by Filter: 0
Planning time : 0.534 ms
Execution time : 1,470.473 ms