explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BSix : test2

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

Limit (cost=173,504.75..173,504.95 rows=51 width=90) (actual time=2.592..2.622 rows=51 loops=1)

2.          

CTE user_events

3. 0.015 2.606 ↑ 10.0 51 1

WindowAgg (cost=173,501.69..173,504.75 rows=510 width=45) (actual time=2.592..2.606 rows=51 loops=1)

4. 0.000 2.591 ↑ 10.0 51 1

Limit (cost=173,501.69..173,501.94 rows=510 width=45) (actual time=2.587..2.591 rows=51 loops=1)

5. 0.051 2.591 ↑ 211.3 51 1

Sort (cost=173,501.69..173,507.07 rows=10,775 width=45) (actual time=2.587..2.591 rows=51 loops=1)

  • Sort Key: i.event_time DESC, i.event_uuid DESC
  • Sort Method: quicksort Memory: 41kB
6. 0.053 2.540 ↑ 51.6 209 1

Hash Join (cost=136,202.58..173,394.00 rows=10,775 width=45) (actual time=2.221..2.540 rows=209 loops=1)

  • Hash Cond: (i.event_definition_id = d.event_definition_id)
7. 0.320 0.320 ↑ 94.3 209 1

Index Only Scan using idx_instance1 on event_instance i (cost=122,998.97..160,154.05 rows=19,713 width=49) (actual time=0.033..0.320 rows=209 loops=1)

  • Index Cond: ((account_id = '1-7KLGH'::text) AND (event_definition_id = ANY ('{1048105,1048106,1048087,415195}'::integer[])) 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
8.          

SubPlan (for Index Only Scan)

9. 0.000 0.000 ↓ 0.0 0

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

10. 0.000 0.000 ↓ 0.0 0

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

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

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

12. 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)))
13. 0.081 2.167 ↑ 5.0 686 1

Hash (cost=13,195.04..13,195.04 rows=3,430 width=4) (actual time=2.167..2.167 rows=686 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 57kB
14. 2.086 2.086 ↑ 5.0 686 1

Index Scan using pk_event_definition on event_definition d (cost=0.06..13,195.04 rows=3,430 width=4) (actual time=0.008..2.086 rows=686 loops=1)

  • Filter: (portal_visible = 1)
  • Rows Removed by Filter: 569
15. 2.618 2.618 ↑ 10.0 51 1

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