explain.depesz.com

PostgreSQL's explain analyze made readable

Result: K2Ht

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 0.466 ↑ 1.0 51 1

Limit (cost=131,594.05..131,594.26 rows=51 width=90) (actual time=0.439..0.466 rows=51 loops=1)

2.          

CTE user_events

3. 0.010 0.452 ↑ 10.0 51 1

WindowAgg (cost=131,590.99..131,594.05 rows=510 width=45) (actual time=0.438..0.452 rows=51 loops=1)

4. 0.004 0.442 ↑ 10.0 51 1

Limit (cost=131,590.99..131,591.25 rows=510 width=45) (actual time=0.435..0.442 rows=51 loops=1)

5. 0.042 0.438 ↑ 28.9 51 1

Sort (cost=131,590.99..131,591.73 rows=1,473 width=45) (actual time=0.435..0.438 rows=51 loops=1)

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

Nested Loop (cost=64,597.37..131,576.27 rows=1,473 width=45) (actual time=0.040..0.396 rows=209 loops=1)

7. 0.006 0.031 ↓ 2.0 4 1

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

8. 0.004 0.005 ↑ 1.0 4 1

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

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

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

10. 0.020 0.020 ↑ 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.003..0.005 rows=1 loops=4)

  • Index Cond: (event_definition_id = "*VALUES*".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=64,597.30..65,776.65 rows=674 width=49) (actual time=0.012..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

Index Scan using pk_acg_objects on acg_objects (cost=0.11..64,573.27 rows=47,772 width=11) (never executed)

  • Index Cond: ((acg_id)::text = ANY ('{1-3CV382.G48558,1-3CV382,1-3CV382.58,1-3CV382.G43258,C-YQNZGB,1-5D6W5V,M-1TIM7OZ,1-5OCLF9,3-3RW041,1-6IS3A,3-984FEB,3-1CTJD9,C-3FUN9Q,3-EU0KNT,3-3RWH9W,3-Z43TJ8,3-1KQJ1R,2-2EZBD,F-A50DD5,1-5QRKWT,1-7KLGU,3-1CTJCM,3-96PCPT,3-P8WDN,C-1I55Q5R,1-5D6W5P,2-4MKQ5,3-16E17BO,3-91ZYJX,1-IZI1J,3-1LM4D5,F-ENX1W3,3-20Z36Z,C-1C3F5RC,M-243W5NL,M-23WNSO7,M-23WNSPH,M-243W5N2,M-242XCHV,3-2CSW8N,3-20Z3GY,M-23WNSQX,M-24068J2,3-20Z3EW,C-XVUI8F,M-24068HJ,C-PYGKR9,3-VSGLFJ,M-23L4181,M-1MEE8RP,M-23L0KB0,3-1EOW5VV}'::text[]))
  • 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)))
14. 0.464 0.464 ↑ 10.0 51 1

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