explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Zhqy

Settings
# exclusive inclusive rows x rows loops node
1. 1.783 2,456.545 ↓ 179.0 716 1

Sort (cost=168,251.26..168,251.27 rows=4 width=136) (actual time=2,456.452..2,456.545 rows=716 loops=1)

  • Sort Key: (COALESCE(data_stats_event.day)) DESC, (COALESCE(data_stats_event.group1)), (COALESCE(data_stats_event.group2))
  • Sort Method: quicksort Memory: 87kB
2.          

CTE data

3. 14.896 2,401.322 ↓ 14,089.0 14,089 1

Nested Loop (cost=1,000.00..168,251.07 rows=1 width=241) (actual time=1.155..2,401.322 rows=14,089 loops=1)

  • Join Filter: (((stats_session.campaign_id)::numeric >= '1'::numeric) OR (((_hyper_5_4_chunk."values" ->> 'scrollTriggerValue'::text))::numeric <= '100'::numeric))
4. 13.890 2,330.070 ↓ 1,174.1 14,089 1

Nested Loop (cost=1,000.00..168,220.97 rows=12 width=104) (actual time=1.139..2,330.070 rows=14,089 loops=1)

5. 2.127 2,259.824 ↓ 123.6 14,089 1

Gather (cost=1,000.00..167,939.68 rows=114 width=76) (actual time=1.121..2,259.824 rows=14,089 loops=1)

  • Workers Planned: 2
  • Workers Launched: 0
6. 1.464 2,257.697 ↓ 293.5 14,089 1

Parallel Append (cost=0.00..166,928.28 rows=48 width=76) (actual time=0.757..2,257.697 rows=14,089 loops=1)

7. 2,256.232 2,256.232 ↓ 299.8 14,089 1

Parallel Seq Scan on _hyper_5_4_chunk (cost=0.00..166,928.04 rows=47 width=76) (actual time=0.755..2,256.232 rows=14,089 loops=1)

  • Filter: (((created_at)::timestamp without time zone >= '2019-04-01 00:00:00'::timestamp without time zone) AND ((created_at)::timestamp without time zone <= '2019-04-02 23:59:59'::timestamp without time zone) AND ((property_id)::numeric = '1'::numeric))
  • Rows Removed by Filter: 4485910
8. 0.001 0.001 ↓ 0.0 0 1

Parallel Seq Scan on stats_event (cost=0.00..0.00 rows=1 width=76) (actual time=0.000..0.001 rows=0 loops=1)

  • Filter: (((created_at)::timestamp without time zone >= '2019-04-01 00:00:00'::timestamp without time zone) AND ((created_at)::timestamp without time zone <= '2019-04-02 23:59:59'::timestamp without time zone) AND ((property_id)::numeric = '1'::numeric))
9. 0.000 56.356 ↑ 2.0 1 14,089

Custom Scan (ConstraintAwareAppend) (cost=0.00..2.45 rows=2 width=44) (actual time=0.004..0.004 rows=1 loops=14,089)

  • Hypertable: stats_page_view
  • Chunks left after exclusion: 1
10. 0.000 56.356 ↑ 2.0 1 14,089

Append (cost=0.00..2.45 rows=2 width=44) (actual time=0.004..0.004 rows=1 loops=14,089)

11. 56.356 56.356 ↑ 1.0 1 14,089

Index Scan using "3_3_stats_page_view_id" on _hyper_3_3_chunk (cost=0.42..2.44 rows=1 width=44) (actual time=0.004..0.004 rows=1 loops=14,089)

  • Index Cond: (id = _hyper_5_4_chunk.page_view_id)
  • Filter: (((created_at)::timestamp without time zone >= '2019-04-01 00:00:00'::timestamp without time zone) AND ((created_at)::timestamp without time zone <= '2019-04-02 23:59:59'::timestamp without time zone) AND ((property_id)::numeric = '1'::numeric))
12. 14.089 56.356 ↑ 2.0 1 14,089

Custom Scan (ConstraintAwareAppend) (cost=0.00..2.46 rows=2 width=157) (actual time=0.003..0.004 rows=1 loops=14,089)

  • Hypertable: stats_session
  • Chunks left after exclusion: 1
13. 0.000 42.267 ↑ 2.0 1 14,089

Append (cost=0.00..2.46 rows=2 width=157) (actual time=0.003..0.003 rows=1 loops=14,089)

14. 42.267 42.267 ↑ 1.0 1 14,089

Index Scan using "2_2_stats_session_id" on _hyper_2_2_chunk (cost=0.41..2.45 rows=1 width=52) (actual time=0.003..0.003 rows=1 loops=14,089)

  • Index Cond: (id = stats_page_view.session_id)
  • Filter: (((created_at)::timestamp without time zone >= '2019-04-01 00:00:00'::timestamp without time zone) AND ((created_at)::timestamp without time zone <= '2019-04-02 23:59:59'::timestamp without time zone) AND ((property_id)::numeric = '1'::numeric))
15. 0.124 2,454.762 ↓ 179.0 716 1

Subquery Scan on data_stats_event (cost=0.03..0.15 rows=4 width=136) (actual time=2,445.521..2,454.762 rows=716 loops=1)

16. 7.833 2,454.638 ↓ 179.0 716 1

GroupAggregate (cost=0.03..0.11 rows=4 width=232) (actual time=2,445.519..2,454.638 rows=716 loops=1)

  • Group Key: (COALESCE((data."stats_event.created_at")::text, '-'::text)), (COALESCE((data."stats_session.user_agent_family")::text, '-'::text)), (COALESCE((data."stats_event.event_id")::text, '-'::text))
  • Group Key: (COALESCE((data."stats_event.created_at")::text, '-'::text)), (COALESCE((data."stats_session.user_agent_family")::text, '-'::text))
  • Group Key: (COALESCE((data."stats_event.created_at")::text, '-'::text))
  • Group Key: ()
17. 27.844 2,446.805 ↓ 14,089.0 14,089 1

Sort (cost=0.03..0.04 rows=1 width=148) (actual time=2,445.503..2,446.805 rows=14,089 loops=1)

  • Sort Key: (COALESCE((data."stats_event.created_at")::text, '-'::text)), (COALESCE((data."stats_session.user_agent_family")::text, '-'::text)), (COALESCE((data."stats_event.event_id")::text, '-'::text))
  • Sort Method: quicksort Memory: 2355kB
18. 2,418.961 2,418.961 ↓ 14,089.0 14,089 1

CTE Scan on data (cost=0.00..0.02 rows=1 width=148) (actual time=1.162..2,418.961 rows=14,089 loops=1)

Planning time : 0.683 ms
Execution time : 2,457.431 ms