explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OjHd

Settings
# exclusive inclusive rows x rows loops node
1. 0.057 65.699 ↓ 1.8 9 1

Nested Loop (cost=1,349.93..1,361.25 rows=5 width=84) (actual time=6.065..65.699 rows=9 loops=1)

2.          

CTE users

3. 0.010 0.291 ↓ 1.8 9 1

Nested Loop (cost=0.56..117.85 rows=5 width=4) (actual time=0.088..0.291 rows=9 loops=1)

4. 0.010 0.226 ↑ 1.5 11 1

Nested Loop (cost=0.28..110.66 rows=17 width=4) (actual time=0.081..0.226 rows=11 loops=1)

5. 0.180 0.180 ↓ 2.0 2 1

Seq Scan on profile_team (cost=0.00..94.92 rows=1 width=4) (actual time=0.073..0.180 rows=2 loops=1)

  • Filter: (is_active AND ((name)::text = ANY ('{"Front Office Mail Shift 1","Front Office Mail Shift 2"}'::text[])))
  • Rows Removed by Filter: 232
6. 0.036 0.036 ↑ 2.2 6 2

Index Scan using profile_userconfig_f6a7ca40 on profile_userconfig (cost=0.28..15.60 rows=13 width=8) (actual time=0.006..0.018 rows=6 loops=2)

  • Index Cond: (team_id = profile_team.id)
7. 0.055 0.055 ↑ 1.0 1 11

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

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

CTE inboxes

9. 0.369 65.583 ↓ 1.8 9 1

CTE Scan on users (cost=0.00..1,231.80 rows=5 width=52) (actual time=6.049..65.583 rows=9 loops=1)

10.          

SubPlan (forCTE Scan)

11. 0.792 53.757 ↑ 1.0 1 9

Aggregate (cost=6.79..6.80 rows=1 width=8) (actual time=5.973..5.973 rows=1 loops=9)

12.          

Initplan (forAggregate)

13. 0.009 0.009 ↑ 1.0 1 1

Index Scan using idx_user_email on auth_user auth_user_2 (cost=0.28..2.30 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: ((email)::text = 'crm@ostrovok.ru'::text)
14. 52.956 52.956 ↓ 547.0 547 9

Index Only Scan using idx_inbox_desktop_4 on tickets_ticketsimple (cost=0.43..4.49 rows=1 width=0) (actual time=0.836..5.884 rows=547 loops=9)

  • Index Cond: ((created_by_id = $3) AND (modified_dt >= '2019-05-01 00:00:00+00'::timestamp with time zone) AND (modified_dt <= '2019-06-01 00:00:00+00'::timestamp with time zone) AND (modified_by_id = users.user_id))
  • Heap Fetches: 4923
15. 0.081 0.747 ↑ 1.0 1 9

Aggregate (cost=27.49..27.50 rows=1 width=8) (actual time=0.083..0.083 rows=1 loops=9)

16. 0.666 0.666 ↑ 3.0 46 9

Index Only Scan using idx_inbox_desktop_4 on tickets_ticketsimple tickets_ticketsimple_1 (cost=0.43..27.15 rows=137 width=0) (actual time=0.013..0.074 rows=46 loops=9)

  • Index Cond: ((created_by_id = users.user_id) AND (modified_dt >= '2019-05-01 00:00:00+00'::timestamp with time zone) AND (modified_dt <= '2019-06-01 00:00:00+00'::timestamp with time zone))
  • Heap Fetches: 418
17. 0.063 10.710 ↑ 1.0 1 9

Aggregate (cost=212.02..212.04 rows=1 width=32) (actual time=1.190..1.190 rows=1 loops=9)

18. 0.120 10.647 ↓ 17.0 17 9

Nested Loop (cost=0.85..212.02 rows=1 width=4) (actual time=1.078..1.183 rows=17 loops=9)

19. 1.431 1.431 ↓ 2.7 168 9

Index Scan using idx_evaluations_model_user_related_id on crm_asterisk_evaluation e (cost=0.42..59.96 rows=62 width=8) (actual time=0.019..0.159 rows=168 loops=9)

  • Index Cond: ((user_id = users.user_id) AND ((related_to_model)::text = 'Inbox'::text))
20. 9.096 9.096 ↓ 0.0 0 1,516

Index Scan using idx_inbox_desktop_2 on tickets_ticketsimple i (cost=0.43..2.45 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=1,516)

  • Index Cond: (id = e.related_to_id)
  • Filter: ((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))
  • Rows Removed by Filter: 1
21. 65.597 65.597 ↓ 1.8 9 1

CTE Scan on inboxes (cost=0.00..0.10 rows=5 width=52) (actual time=6.051..65.597 rows=9 loops=1)

22. 0.045 0.045 ↑ 1.0 1 9

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

  • Index Cond: (id = inboxes.user_id)
Planning time : 1.453 ms
Execution time : 65.856 ms