explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Z5eu

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 28.651 ↑ 1.0 100 1

Limit (cost=10,481.73..10,481.98 rows=100 width=53) (actual time=28.637..28.651 rows=100 loops=1)

2. 1.122 28.641 ↑ 22.4 100 1

Sort (cost=10,481.73..10,487.34 rows=2,243 width=53) (actual time=28.635..28.641 rows=100 loops=1)

  • Sort Key: ((SubPlan 1)) DESC, chat_ticket.created_at
  • Sort Method: top-N heapsort Memory: 39kB
3. 2.153 27.519 ↑ 1.0 2,238 1

Hash Join (cost=5.79..10,396.01 rows=2,243 width=53) (actual time=0.073..27.519 rows=2,238 loops=1)

  • Hash Cond: (chat_ticket.theme_id = chat_user_manager.theme_id)
4. 0.000 18.622 ↑ 1.0 2,238 1

Nested Loop (cost=0.42..4,616.51 rows=2,238 width=45) (actual time=0.026..18.622 rows=2,238 loops=1)

5. 0.725 0.725 ↑ 1.0 2,238 1

Seq Scan on chat_ticket (cost=0.00..69.51 rows=2,238 width=45) (actual time=0.007..0.725 rows=2,238 loops=1)

  • Filter: (NOT is_archive)
  • Rows Removed by Filter: 1,313
6. 17.904 17.904 ↑ 1.0 1 2,238

Index Scan using ccp_flight_pkey on ccp_flight (cost=0.42..2.02 rows=1 width=4) (actual time=0.007..0.008 rows=1 loops=2,238)

  • Index Cond: (id = chat_ticket.flight_id)
  • Filter: (carrier = ANY ('{1,2}'::integer[]))
7. 0.001 0.030 ↑ 1.0 9 1

Hash (cost=5.25..5.25 rows=9 width=4) (actual time=0.030..0.030 rows=9 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
8. 0.029 0.029 ↑ 1.0 9 1

Seq Scan on chat_user_manager (cost=0.00..5.25 rows=9 width=4) (actual time=0.007..0.029 rows=9 loops=1)

  • Filter: (user_id = 623)
  • Rows Removed by Filter: 251
9.          

SubPlan (for Hash Join)

10. 2.238 6.714 ↑ 1.0 1 2,238

Aggregate (cost=2.54..2.55 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=2,238)

11. 4.476 4.476 ↑ 1.0 2 2,238

Index Scan using chat_message_ticket_id_idx on chat_message (cost=0.29..2.54 rows=2 width=8) (actual time=0.002..0.002 rows=2 loops=2,238)

  • Index Cond: (ticket_id = chat_ticket.id)