explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZPDo

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 7.625 ↑ 1.0 1 1

Sort (cost=1,464.19..1,464.20 rows=1 width=20) (actual time=7.625..7.625 rows=1 loops=1)

  • Sort Key: routing_table.calculated_priority, routing_table.waiting_time DESC
  • Sort Method: quicksort Memory: 25kB
2.          

CTE routing_table

3. 0.011 7.607 ↑ 1.0 1 1

Sort (cost=1,464.16..1,464.16 rows=1 width=28) (actual time=7.606..7.607 rows=1 loops=1)

  • Sort Key: cqe.priority, (date_part('epoch'::text, (now() - max(cr.created_on)))) DESC
  • Sort Method: quicksort Memory: 25kB
4. 0.020 7.596 ↑ 1.0 1 1

GroupAggregate (cost=1,464.11..1,464.15 rows=1 width=28) (actual time=7.596..7.596 rows=1 loops=1)

  • Group Key: cqe.employee_id, cqe.priority
5. 0.021 7.576 ↑ 1.0 1 1

Sort (cost=1,464.11..1,464.12 rows=1 width=20) (actual time=7.576..7.576 rows=1 loops=1)

  • Sort Key: cqe.priority
  • Sort Method: quicksort Memory: 25kB
6. 0.005 7.555 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.00..1,464.10 rows=1 width=20) (actual time=7.546..7.555 rows=1 loops=1)

  • Join Filter: (c.user_id = cqe.user_id)
  • Rows Removed by Join Filter: 6
7. 0.003 2.189 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.00..349.55 rows=1 width=20) (actual time=2.181..2.189 rows=1 loops=1)

  • Join Filter: (cr.employee_id = cqe.employee_id)
8. 0.022 0.022 ↑ 1.0 1 1

Seq Scan on chat_queue_employees cqe (cost=0.00..2.27 rows=1 width=12) (actual time=0.014..0.022 rows=1 loops=1)

  • Filter: ((employee_id = 7344) AND (chat_queue_id = 9))
  • Rows Removed by Filter: 84
9. 2.164 2.164 ↓ 0.0 0 1

Seq Scan on chat_routings cr (cost=0.00..347.26 rows=1 width=12) (actual time=2.164..2.164 rows=0 loops=1)

  • Filter: ((employee_id = 7344) AND (created_on >= (now() - '1 day'::interval)))
  • Rows Removed by Filter: 10914
10. 5.361 5.361 ↓ 6.0 6 1

Seq Scan on chats c (cost=0.00..1,114.54 rows=1 width=8) (actual time=5.349..5.361 rows=6 loops=1)

  • Filter: ((chat_status_type_id = 6) AND (created_on >= (now() - '1 day'::interval)))
  • Rows Removed by Filter: 20824
11. 7.613 7.613 ↑ 1.0 1 1

CTE Scan on routing_table (cost=0.00..0.02 rows=1 width=20) (actual time=7.612..7.613 rows=1 loops=1)