explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jS14

Settings
# exclusive inclusive rows x rows loops node
1. 0.035 17.727 ↓ 1.6 8 1

Nested Loop (cost=1,584.95..1,596.27 rows=5 width=84) (actual time=3.675..17.727 rows=8 loops=1)

2.          

CTE users

3. 0.009 0.345 ↓ 1.6 8 1

Nested Loop (cost=0.71..25.22 rows=5 width=4) (actual time=0.084..0.345 rows=8 loops=1)

4. 0.017 0.132 ↓ 3.0 51 1

Nested Loop (cost=0.43..18.05 rows=17 width=4) (actual time=0.030..0.132 rows=51 loops=1)

5. 0.023 0.023 ↓ 2.0 2 1

Index Only Scan using idx_team_uid on profile_team (cost=0.14..2.31 rows=1 width=4) (actual time=0.016..0.023 rows=2 loops=1)

  • Index Cond: (team_uid = ANY ('{support_shift_1,support_shift_2}'::text[]))
  • Heap Fetches: 0
6. 0.092 0.092 ↓ 2.0 26 2

Index Scan using profile_userconfig_f6a7ca40 on profile_userconfig (cost=0.28..15.60 rows=13 width=8) (actual time=0.010..0.046 rows=26 loops=2)

  • Index Cond: (team_id = profile_team.id)
7. 0.204 0.204 ↓ 0.0 0 51

Index Scan using auth_user_pkey on auth_user auth_user_1 (cost=0.28..0.42 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=51)

  • Index Cond: (id = profile_userconfig.user_id)
  • Filter: is_active
  • Rows Removed by Filter: 1
8.          

CTE inboxes

9. 0.378 17.650 ↓ 1.6 8 1

CTE Scan on users (cost=0.00..1,559.45 rows=5 width=52) (actual time=3.657..17.650 rows=8 loops=1)

10.          

SubPlan (forCTE Scan)

11. 0.024 0.192 ↑ 1.0 1 8

Aggregate (cost=12.14..12.15 rows=1 width=8) (actual time=0.024..0.024 rows=1 loops=8)

12. 0.168 0.168 ↑ 4.0 8 8

Index Only Scan using idx_tickets_created on tickets_ticket (cost=0.43..12.06 rows=32 width=0) (actual time=0.011..0.021 rows=8 loops=8)

  • Index Cond: ((created_by_id = users.user_id) AND (created_dt >= '2019-05-01 00:00:00+00'::timestamp with time zone) AND (created_dt <= '2019-06-01 00:00:00+00'::timestamp with time zone))
  • Heap Fetches: 67
13. 0.272 2.472 ↑ 1.0 1 8

Aggregate (cost=7.27..7.28 rows=1 width=8) (actual time=0.309..0.309 rows=1 loops=8)

14. 2.200 2.200 ↓ 12.5 212 8

Index Only Scan using idx_tickets_resolved on tickets_ticket tickets_ticket_1 (cost=0.42..7.23 rows=17 width=0) (actual time=0.020..0.275 rows=212 loops=8)

  • Index Cond: ((resolved_by_id = users.user_id) AND (resolve_dt >= '2019-05-01 00:00:00+00'::timestamp with time zone) AND (resolve_dt <= '2019-06-01 00:00:00+00'::timestamp with time zone))
  • Heap Fetches: 1699
15. 0.064 14.608 ↑ 1.0 1 8

Aggregate (cost=292.43..292.44 rows=1 width=32) (actual time=1.826..1.826 rows=1 loops=8)

16. 1.038 14.544 ↓ 21.0 21 8

Nested Loop (cost=0.85..292.42 rows=1 width=4) (actual time=1.569..1.818 rows=21 loops=8)

17. 1.936 1.936 ↓ 3.4 289 8

Index Scan using idx_evaluations_model_user_related_id on crm_asterisk_evaluation e (cost=0.42..81.72 rows=86 width=8) (actual time=0.023..0.242 rows=289 loops=8)

  • Index Cond: ((user_id = users.user_id) AND ((related_to_model)::text = 'Ticket'::text))
18. 11.570 11.570 ↓ 0.0 0 2,314

Index Scan using tickets_ticket_pkey on tickets_ticket t (cost=0.43..2.45 rows=1 width=4) (actual time=0.005..0.005 rows=0 loops=2,314)

  • Index Cond: (id = e.related_to_id)
  • Filter: (is_active AND (resolved_by_id IS NOT NULL) AND (resolve_dt >= '2019-05-01 00:00:00+00'::timestamp with time zone) AND (resolve_dt <= '2019-06-01 00:00:00+00'::timestamp with time zone))
  • Rows Removed by Filter: 1
19. 17.660 17.660 ↓ 1.6 8 1

CTE Scan on inboxes (cost=0.00..0.10 rows=5 width=52) (actual time=3.659..17.660 rows=8 loops=1)

20. 0.032 0.032 ↑ 1.0 1 8

Index Scan using auth_user_pkey on auth_user (cost=0.28..2.30 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=8)

  • Index Cond: (id = inboxes.user_id)