explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZVx7

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 2.073 ↑ 1.0 50 1

Limit (cost=123.02..128.55 rows=50 width=133) (actual time=2.002..2.073 rows=50 loops=1)

2. 0.063 2.064 ↑ 2.6 50 1

Nested Loop Left Join (cost=123.02..137.18 rows=128 width=133) (actual time=2.001..2.064 rows=50 loops=1)

  • Join Filter: ((patient.patient_id)::text = (inspection_rank.patient_id)::text)
  • Rows Removed by Join Filter: 50
3. 0.044 2.001 ↑ 2.6 50 1

Merge Join (cost=107.39..110.09 rows=128 width=107) (actual time=1.955..2.001 rows=50 loops=1)

  • Merge Cond: ((patient.patient_id)::text = (patient_with_users.patient_id)::text)
4. 0.229 1.035 ↑ 2.6 50 1

Sort (cost=32.09..32.41 rows=128 width=75) (actual time=1.032..1.035 rows=50 loops=1)

  • Sort Key: patient.patient_id DESC
  • Sort Method: quicksort Memory: 39kB
5. 0.639 0.806 ↑ 1.5 83 1

Hash Left Join (cost=18.93..27.61 rows=128 width=75) (actual time=0.754..0.806 rows=83 loops=1)

  • Hash Cond: ((patient.organization_id)::text = (organization.organization_id)::text)
6. 0.044 0.044 ↑ 1.5 83 1

Seq Scan on patients patient (cost=0.00..8.34 rows=128 width=70) (actual time=0.008..0.044 rows=83 loops=1)

  • Filter: ((NOT is_deleted) AND (created_at <= now()))
  • Rows Removed by Filter: 17
7. 0.059 0.123 ↓ 1.0 399 1

Hash (cost=13.97..13.97 rows=397 width=20) (actual time=0.123..0.123 rows=399 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
8. 0.064 0.064 ↓ 1.0 399 1

Seq Scan on organizations organization (cost=0.00..13.97 rows=397 width=20) (actual time=0.008..0.064 rows=399 loops=1)

9. 0.236 0.922 ↑ 2.4 65 1

Sort (cost=75.31..75.70 rows=156 width=42) (actual time=0.919..0.922 rows=65 loops=1)

  • Sort Key: patient_with_users.patient_id DESC
  • Sort Method: quicksort Memory: 36kB
10. 0.009 0.686 ↑ 1.6 100 1

Subquery Scan on patient_with_users (cost=65.72..69.62 rows=156 width=42) (actual time=0.619..0.686 rows=100 loops=1)

11. 0.147 0.677 ↑ 1.6 100 1

HashAggregate (cost=65.72..68.06 rows=156 width=42) (actual time=0.618..0.677 rows=100 loops=1)

  • Group Key: p.patient_id
12. 0.072 0.530 ↓ 1.1 191 1

Hash Right Join (cost=58.42..62.80 rows=167 width=34) (actual time=0.479..0.530 rows=191 loops=1)

  • Hash Cond: ((uxp.patient_id)::text = (p.patient_id)::text)
13. 0.131 0.458 ↓ 1.1 191 1

Sort (cost=48.91..49.32 rows=167 width=66) (actual time=0.450..0.458 rows=191 loops=1)

  • Sort Key: ((((u.last_name)::text || ' '::text) || (u.first_name)::text)) DESC
  • Sort Method: quicksort Memory: 46kB
14. 0.300 0.327 ↓ 1.1 191 1

Hash Left Join (cost=37.80..42.74 rows=167 width=66) (actual time=0.253..0.327 rows=191 loops=1)

  • Hash Cond: ((uxp.user_id)::text = (u.user_id)::text)
15. 0.027 0.027 ↓ 1.1 191 1

Seq Scan on user_x_patients uxp (cost=0.00..3.67 rows=167 width=18) (actual time=0.004..0.027 rows=191 loops=1)

  • Filter: (NOT is_deleted)