explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HbkD

Settings
# exclusive inclusive rows x rows loops node
1. 861.360 5,462.261 ↑ 1.4 109,917 1

Sort (cost=119,125.71..119,509.91 rows=153,683 width=280) (actual time=5,351.756..5,462.261 rows=109,917 loops=1)

  • Sort Key: x2."serviceDate", x2.id
  • Sort Method: quicksort Memory: 32,526kB
2. 402.842 4,600.901 ↑ 1.4 109,917 1

HashAggregate (cost=104,349.40..105,886.23 rows=153,683 width=280) (actual time=4,449.688..4,600.901 rows=109,917 loops=1)

  • Group Key: x2.id
3. 491.803 4,198.059 ↑ 2.1 157,069 1

Nested Loop (cost=20,119.57..103,543.13 rows=322,508 width=280) (actual time=425.130..4,198.059 rows=157,069 loops=1)

  • Join Filter: (x2."apptId" = x3.id)
4. 349.271 3,077.980 ↓ 2.6 157,069 1

Hash Join (cost=20,119.15..75,914.72 rows=60,020 width=296) (actual time=425.103..3,077.980 rows=157,069 loops=1)

  • Hash Cond: (x4."doctorId" = doctors.id)
5. 816.330 2,727.391 ↑ 1.2 223,135 1

Merge Join (cost=20,016.01..74,194.67 rows=271,122 width=312) (actual time=423.774..2,727.391 rows=223,135 loops=1)

  • Merge Cond: (x4."apptId" = x2."apptId")
6. 1,252.774 1,252.774 ↑ 8.9 468,080 1

Index Scan using "slotToApptFkIdx" on slots x4 (cost=0.43..452,982.24 rows=4,158,068 width=32) (actual time=0.007..1,252.774 rows=468,080 loops=1)

7. 470.043 658.287 ↓ 1.5 223,232 1

Sort (cost=20,010.31..20,394.52 rows=153,683 width=280) (actual time=423.696..658.287 rows=223,232 loops=1)

  • Sort Key: x2."apptId
  • Sort Method: quicksort Memory: 47,374kB
8. 188.244 188.244 ↑ 1.0 153,683 1

Seq Scan on bills x2 (cost=0.00..6,770.83 rows=153,683 width=280) (actual time=0.013..188.244 rows=153,683 loops=1)

9. 0.405 1.318 ↓ 1.0 446 1

Hash (cost=97.67..97.67 rows=437 width=16) (actual time=1.317..1.318 rows=446 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 29kB
10. 0.913 0.913 ↓ 1.0 446 1

Seq Scan on doctors (cost=0.00..97.67 rows=437 width=16) (actual time=0.009..0.913 rows=446 loops=1)

  • Filter: ("practiceId" = '5bdaef44-8ff0-439f-99d7-3285afcc6911'::uuid)
  • Rows Removed by Filter: 1,542
11. 628.276 628.276 ↑ 1.0 1 157,069

Index Only Scan using appointments_pkey on appts x3 (cost=0.42..0.45 rows=1 width=16) (actual time=0.003..0.004 rows=1 loops=157,069)

  • Index Cond: (id = x4."apptId")
  • Heap Fetches: 14,761
Planning time : 1.015 ms
Execution time : 5,550.911 ms