explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FlU6

Settings
# exclusive inclusive rows x rows loops node
1. 4.106 683.828 ↑ 200.0 1 1

HashAggregate (cost=7,638.20..7,640.20 rows=200 width=45) (actual time=683.814..683.828 rows=1 loops=1)

  • Group Key: al.identity_id
  • Buffers: shared hit=2509
2. 14.801 679.722 ↑ 21.9 505 1

HashAggregate (cost=7,333.50..7,472.00 rows=11,080 width=53) (actual time=675.897..679.722 rows=505 loops=1)

  • Group Key: al.identity_id, al.start_time
  • Buffers: shared hit=2509
3.          

CTE tz

4. 0.045 0.506 ↑ 1.0 1 1

Result (cost=0.59..0.60 rows=1 width=32) (actual time=0.492..0.506 rows=1 loops=1)

  • Buffers: shared hit=9
5.          

Initplan (forResult)

6. 0.039 0.461 ↑ 1.0 1 1

Limit (cost=0.00..0.30 rows=1 width=32) (actual time=0.428..0.461 rows=1 loops=1)

  • Buffers: shared hit=9
7. 0.422 0.422 ↑ 59,402.0 1 1

Seq Scan on activity_log_activitylog (cost=0.00..17,629.04 rows=59,402 width=32) (actual time=0.407..0.422 rows=1 loops=1)

  • Filter: ((((identity_id)::text = 'bb6eb20e-efd2-4828-8286-9657822e5353'::text) AND ((datasource)::text = 'applehealth'::text)) OR ((datasource)::text = 'googlefit'::text))
  • Rows Removed by Filter: 377
  • Buffers: shared hit=9
8. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.00..0.30 rows=1 width=32) (never executed)

9. 0.000 0.000 ↓ 0.0 0

Seq Scan on activity_log_activitylog activity_log_activitylog_1 (cost=0.00..17,629.04 rows=59,402 width=32) (never executed)

  • Filter: ((((identity_id)::text = 'bb6eb20e-efd2-4828-8286-9657822e5353'::text) AND ((datasource)::text = 'applehealth'::text)) OR ((datasource)::text = 'googlefit'::text))
10. 350.338 664.921 ↑ 11.0 1,004 1

Nested Loop (cost=0.42..7,249.79 rows=11,080 width=53) (actual time=0.734..664.921 rows=1,004 loops=1)

  • Join Filter: (al.start_time >= timezone('UTC'::text, timezone(tz."offset", date_trunc('day'::text, timezone(tz."offset", LOCALTIMESTAMP)))))
  • Rows Removed by Join Filter: 34372
  • Buffers: shared hit=2509
11. 0.541 0.541 ↑ 1.0 1 1

CTE Scan on tz (cost=0.00..0.02 rows=1 width=32) (actual time=0.508..0.541 rows=1 loops=1)

  • Buffers: shared hit=9
12. 314.042 314.042 ↓ 1.1 35,376 1

Index Scan using activity_log_activitylog_user_id_facfa596 on activity_log_activitylog al (cost=0.42..6,418.80 rows=33,239 width=53) (actual time=0.195..314.042 rows=35,376 loops=1)

  • Index Cond: ((identity_id)::text = 'bb6eb20e-efd2-4828-8286-9657822e5353'::text)
  • Filter: ((steps > '0'::double precision) AND (start_time <= CURRENT_TIMESTAMP))
  • Rows Removed by Filter: 51024
  • Buffers: shared hit=2500