explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cgkS

Settings
# exclusive inclusive rows x rows loops node
1. 1,958.893 1,958.893 ↑ 16,178.7 3 1

CTE Scan on metrics (cost=200,757.32..201,728.04 rows=48,536 width=344) (actual time=1,513.720..1,958.893 rows=3 loops=1)

2.          

CTE facts

3. 1,048.014 1,958.814 ↑ 29,121.8 5 1

GroupAggregate (cost=157,317.33..192,627.51 rows=145,609 width=356) (actual time=839.508..1,958.814 rows=5 loops=1)

  • Group Key: (date_part('week'::text, purecloud_session.session_end_utc))
4. 340.732 910.800 ↓ 2.9 424,145 1

Sort (cost=157,317.33..157,681.35 rows=145,609 width=66) (actual time=810.449..910.800 rows=424,145 loops=1)

  • Sort Key: (date_part('week'::text, purecloud_session.session_end_utc))
  • Sort Method: quicksort Memory: 71,934kB
5. 0.000 570.068 ↓ 2.9 424,145 1

Gather (cost=1,005.34..144,830.09 rows=145,609 width=66) (actual time=0.950..570.068 rows=424,145 loops=1)

  • Workers Planned: 4
  • Workers Launched: 4
6. 147.011 635.750 ↓ 2.3 84,829 5 / 5

Hash Join (cost=5.34..128,996.17 rows=36,402 width=66) (actual time=0.341..635.750 rows=84,829 loops=5)

  • Hash Cond: (((purecloud_session.queue_id)::character varying)::text = (cs_enumeration_queue.purecloud_id)::text)
7. 488.598 488.598 ↑ 1.4 137,912 5 / 5

Parallel Index Scan using purecloud_session_conversation_start_idx on purecloud_session (cost=0.56..126,568.69 rows=196,769 width=82) (actual time=0.132..488.598 rows=137,912 loops=5)

  • Index Cond: (conversation_start_utc > '2019-09-01 00:00:00'::timestamp without time zone)
  • Filter: (direction = 'inbound'::text)
  • Rows Removed by Filter: 69,899
8. 0.019 0.141 ↓ 1.2 43 5 / 5

Hash (cost=4.31..4.31 rows=37 width=36) (actual time=0.141..0.141 rows=43 loops=5)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
9. 0.122 0.122 ↓ 1.2 43 5 / 5

Seq Scan on cs_enumeration_queue (cost=0.00..4.31 rows=37 width=36) (actual time=0.090..0.122 rows=43 loops=5)

  • Filter: (((business_unit)::text = 'Front office'::text) AND ((type_name)::text = ANY ('{customer,internal,partner}'::text[])))
  • Rows Removed by Filter: 99
10.          

CTE metrics

11. 1,958.886 1,958.886 ↑ 16,178.7 3 1

CTE Scan on facts (cost=0.00..8,129.81 rows=48,536 width=344) (actual time=1,513.718..1,958.886 rows=3 loops=1)

  • Filter: (week > (date_part('week'::text, now()) - '3'::double precision))
  • Rows Removed by Filter: 2
Planning time : 1.947 ms
Execution time : 1,964.645 ms