explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8YhI

Settings
# exclusive inclusive rows x rows loops node
1. 196.645 505.074 ↓ 1,137.0 1,137 1

Nested Loop Left Join (cost=1.55..65,556.44 rows=1 width=3,895) (actual time=1.182..505.074 rows=1,137 loops=1)

  • Join Filter: (((items.author_type)::text = 'User'::text) AND (users.id = items.author_id))
  • Rows Removed by Join Filter: 1657746
2. 7.548 136.742 ↓ 1,137.0 1,137 1

Nested Loop Left Join (cost=1.55..65,427.96 rows=1 width=3,408) (actual time=0.473..136.742 rows=1,137 loops=1)

  • Join Filter: (sources.id = items.source_id)
  • Rows Removed by Join Filter: 68220
3. 0.464 90.536 ↓ 1,137.0 1,137 1

Nested Loop (cost=1.55..65,372.59 rows=1 width=3,152) (actual time=0.234..90.536 rows=1,137 loops=1)

4. 0.905 29.433 ↓ 1.9 697 1

Nested Loop (cost=0.99..32,377.71 rows=375 width=3,012) (actual time=0.162..29.433 rows=697 loops=1)

5. 7.157 7.157 ↑ 1.1 3,053 1

Index Scan using index_items_on_type_and_author_type_and_created_at on items (cost=0.56..7,737.93 rows=3,243 width=1,041) (actual time=0.103..7.157 rows=3,053 loops=1)

  • Index Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'User'::text) AND (created_at >= '2018-12-11 00:00:00'::timestamp without time zone) AND (created_at <= '2018-12-11 23:59:59.999999'::timestamp without time zone))
6. 21.371 21.371 ↓ 0.0 0 3,053

Index Scan using tickets_pkey on tickets (cost=0.43..7.59 rows=1 width=1,971) (actual time=0.007..0.007 rows=0 loops=3,053)

  • Index Cond: (id = items.ticket_id)
  • Filter: (group_id = 18)
  • Rows Removed by Filter: 1
7. 60.639 60.639 ↓ 2.0 2 697

Index Scan using index_events_on_ticket_id on events (cost=0.56..87.98 rows=1 width=140) (actual time=0.047..0.087 rows=2 loops=697)

  • Index Cond: (ticket_id = tickets.id)
  • Filter: ((created_at >= '2018-12-11 00:00:00'::timestamp without time zone) AND (created_at <= '2018-12-11 23:59:59.999999'::timestamp without time zone) AND ((type)::text = 'TicketViewed'::text) AND (((data)::json ->> 'opened_by'::text) = ((data)::json ->> 'managed_by'::text)))
  • Rows Removed by Filter: 21
8. 38.658 38.658 ↑ 1.0 61 1,137

Seq Scan on sources (cost=0.00..54.61 rows=61 width=256) (actual time=0.001..0.034 rows=61 loops=1,137)

9. 171.687 171.687 ↑ 1.0 1,459 1,137

Seq Scan on users (cost=0.00..106.59 rows=1,459 width=487) (actual time=0.002..0.151 rows=1,459 loops=1,137)