explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fah4

Settings
# exclusive inclusive rows x rows loops node
1. 0.171 0.986 ↑ 254.0 5 1

CTE Scan on r (cost=1,401.08..1,702.70 rows=1,270 width=70) (actual time=0.775..0.986 rows=5 loops=1)

2.          

CTE r

3. 0.036 0.036 ↑ 254.0 5 1

Seq Scan on routine r_1 (cost=0.00..22.70 rows=1,270 width=26) (actual time=0.010..0.036 rows=5 loops=1)

4.          

CTE wrca

5. 0.327 0.725 ↓ 0.0 0 1

Nested Loop (cost=8.36..1,378.38 rows=7 width=37) (actual time=0.721..0.725 rows=0 loops=1)

  • Join Filter: (wrca.careplan_id = rc.careplan_id)
6. 0.170 0.170 ↑ 1.0 38 1

Seq Scan on routine_careplan rc (cost=0.00..1.38 rows=38 width=21) (actual time=0.008..0.170 rows=38 loops=1)

7. 0.146 0.228 ↓ 0.0 0 38

Materialize (cost=8.36..1,373.02 rows=7 width=24) (actual time=0.006..0.006 rows=0 loops=38)

8. 0.034 0.082 ↓ 0.0 0 1

Hash Join (cost=8.36..1,372.99 rows=7 width=24) (actual time=0.078..0.082 rows=0 loops=1)

  • Hash Cond: (wrca.weekly_routine_id = wr.weekly_routine_id)
9. 0.012 0.012 ↑ 68,479.0 1 1

Seq Scan on weekly_routine_careplan_answer wrca (cost=0.00..1,184.79 rows=68,479 width=20) (actual time=0.008..0.012 rows=1 loops=1)

10. 0.009 0.036 ↓ 0.0 0 1

Hash (cost=8.35..8.35 rows=1 width=8) (actual time=0.032..0.036 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
11. 0.027 0.027 ↓ 0.0 0 1

Index Scan using weekly_routine_date_class_idx on weekly_routine wr (cost=0.30..8.35 rows=1 width=8) (actual time=0.023..0.027 rows=0 loops=1)

  • Index Cond: ((routine_date >= (date_trunc('week'::text, ('2019-01-27'::date)::timestamp with time zone) - '1 day'::interval)) AND (routine_date < (date_trunc('week'::text, ('2019-01-27'::date)::timestamp with time zone)
  • Filter: (child_id = 14276294)
12.          

SubPlan (for CTE Scan)

13. 0.065 0.815 ↑ 1.0 1 5

Aggregate (cost=0.21..0.22 rows=1 width=32) (actual time=0.158..0.163 rows=1 loops=5)

14. 0.750 0.750 ↓ 0.0 0 5

CTE Scan on wrca wrca_1 (cost=0.00..0.19 rows=1 width=64) (actual time=0.149..0.150 rows=0 loops=5)

  • Filter: ((answer <> '""'::jsonb) AND (title <> 'ssl_nap'::text) AND (routine_id = r.routine_id))