explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Sgim

Settings
# exclusive inclusive rows x rows loops node
1. 7,391.176 7,391.176 ↑ 40,846.3 3 1

CTE Scan on metrics (cost=422,227.84..424,678.62 rows=122,539 width=344) (actual time=6,905.363..7,391.176 rows=3 loops=1)

2.          

CTE facts

3. 2,840.337 7,391.039 ↑ 36,761.8 10 1

GroupAggregate (cost=312,555.16..401,702.52 rows=367,618 width=356) (actual time=4,400.205..7,391.039 rows=10 loops=1)

  • Group Key: (date_part('week'::text, purecloud_session.session_end_utc))
4. 878.066 4,550.702 ↓ 2.9 1,052,350 1

Sort (cost=312,555.16..313,474.20 rows=367,618 width=66) (actual time=4,271.045..4,550.702 rows=1,052,350 loops=1)

  • Sort Key: (date_part('week'::text, purecloud_session.session_end_utc))
  • Sort Method: quicksort Memory: 176,559kB
5. 1,637.866 3,672.636 ↓ 2.9 1,052,350 1

Hash Join (cost=5.34..278,572.83 rows=367,618 width=66) (actual time=0.893..3,672.636 rows=1,052,350 loops=1)

  • Hash Cond: (((purecloud_session.queue_id)::character varying)::text = (cs_enumeration_queue.purecloud_id)::text)
6. 2,034.282 2,034.282 ↑ 1.1 1,756,319 1

Index Scan using purecloud_session_conversation_start_idx on purecloud_session (cost=0.57..254,101.60 rows=1,987,124 width=82) (actual time=0.388..2,034.282 rows=1,756,319 loops=1)

  • Index Cond: (conversation_start_utc >= (now() - '2 mons'::interval))
  • Filter: (direction = 'inbound'::text)
  • Rows Removed by Filter: 893,164
7. 0.021 0.488 ↓ 1.2 43 1

Hash (cost=4.31..4.31 rows=37 width=36) (actual time=0.488..0.488 rows=43 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
8. 0.467 0.467 ↓ 1.2 43 1

Seq Scan on cs_enumeration_queue (cost=0.00..4.31 rows=37 width=36) (actual time=0.427..0.467 rows=43 loops=1)

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

CTE metrics

10. 7,391.168 7,391.168 ↑ 40,846.3 3 1

CTE Scan on facts (cost=0.00..20,525.31 rows=122,539 width=344) (actual time=6,905.360..7,391.168 rows=3 loops=1)

  • Filter: (week > (date_part('week'::text, now()) - '3'::double precision))
  • Rows Removed by Filter: 7
Planning time : 0.566 ms
Execution time : 7,403.816 ms