explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sVKw : test

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 0.530 ↑ 1.0 51 1

Limit (cost=248,397.40..248,397.60 rows=51 width=90) (actual time=0.500..0.530 rows=51 loops=1)

2.          

CTE user_events

3. 0.015 0.514 ↑ 10.0 51 1

WindowAgg (cost=248,394.34..248,397.40 rows=510 width=45) (actual time=0.498..0.514 rows=51 loops=1)

4. 0.002 0.499 ↑ 10.0 51 1

Limit (cost=248,394.34..248,394.59 rows=510 width=45) (actual time=0.494..0.499 rows=51 loops=1)

5. 0.062 0.497 ↑ 28.9 51 1

Sort (cost=248,394.34..248,395.07 rows=1,473 width=45) (actual time=0.494..0.497 rows=51 loops=1)

  • Sort Key: i.event_time DESC, i.event_uuid DESC
  • Sort Method: quicksort Memory: 41kB
6. 0.045 0.435 ↑ 7.0 209 1

Nested Loop (cost=122,999.04..248,379.61 rows=1,473 width=45) (actual time=0.056..0.435 rows=209 loops=1)

7. 0.003 0.042 ↓ 2.0 4 1

Nested Loop (cost=0.07..20.27 rows=2 width=8) (actual time=0.018..0.042 rows=4 loops=1)

8. 0.004 0.007 ↑ 1.0 4 1

HashAggregate (cost=0.01..0.02 rows=4 width=4) (actual time=0.007..0.007 rows=4 loops=1)

  • Group Key: "*VALUES*_1".column1
9. 0.003 0.003 ↑ 1.0 4 1

Values Scan on "*VALUES*_1" (cost=0.00..0.01 rows=4 width=4) (actual time=0.002..0.003 rows=4 loops=1)

10. 0.032 0.032 ↑ 1.0 1 4

Index Scan using pk_event_definition on event_definition d (cost=0.06..5.06 rows=1 width=4) (actual time=0.005..0.008 rows=1 loops=4)

  • Index Cond: (event_definition_id = "*VALUES*_1".column1)
  • Filter: (portal_visible = 1)
11. 0.348 0.348 ↑ 13.0 52 4

Index Only Scan using idx_instance1 on event_instance i (cost=122,998.97..124,178.32 rows=674 width=49) (actual time=0.013..0.087 rows=52 loops=4)

  • Index Cond: ((account_id = '1-7KLGH'::text) AND (event_definition_id = d.event_definition_id) AND (event_time >= (('now'::cstring)::timestamp without time zone - '90 days'::interval day)) AND (event_time <= ('now'::cstring)::timestamp without time zone))
  • Filter: (CASE WHEN ((object_type IS NULL) AND (object_id IS NULL)) THEN 1 WHEN (hashed SubPlan 1) THEN 1 ELSE NULL::integer END IS NOT NULL)
  • Heap Fetches: 183
12.          

SubPlan (for Index Only Scan)

13. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.27..122,938.32 rows=121,015 width=11) (never executed)

14. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=0.16..0.26 rows=52 width=32) (never executed)

  • Group Key: "*VALUES*".column1
15. 0.000 0.000 ↓ 0.0 0

Values Scan on "*VALUES*" (cost=0.00..0.13 rows=52 width=32) (never executed)

16. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_acg_objects on acg_objects (cost=0.11..2,359.54 rows=2,327 width=22) (never executed)

  • Index Cond: ((acg_id)::text = "*VALUES*".column1)
  • Filter: (((NOT parent_user_only) OR (parent_user_only IS NULL)) AND ((akamai_internal_only = ANY ('{t,f}'::boolean[])) OR (akamai_internal_only IS NULL)))
17. 0.526 0.526 ↑ 10.0 51 1

CTE Scan on user_events (cost=0.00..2.04 rows=510 width=90) (actual time=0.499..0.526 rows=51 loops=1)