explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NMAT

Settings
# exclusive inclusive rows x rows loops node
1. 0.088 124.316 ↓ 1.8 9 1

Nested Loop (cost=2,485.70..2,497.02 rows=5 width=84) (actual time=12.410..124.316 rows=9 loops=1)

2.          

CTE users

3. 0.023 0.351 ↓ 1.8 9 1

Nested Loop (cost=0.56..117.49 rows=5 width=4) (actual time=0.120..0.351 rows=9 loops=1)

4. 0.015 0.262 ↑ 1.5 11 1

Nested Loop (cost=0.28..110.59 rows=16 width=4) (actual time=0.104..0.262 rows=11 loops=1)

5. 0.197 0.197 ↓ 2.0 2 1

Seq Scan on profile_team (cost=0.00..94.92 rows=1 width=4) (actual time=0.087..0.197 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.050 0.050 ↑ 2.2 6 2

Index Scan using profile_userconfig_f6a7ca40 on profile_userconfig (cost=0.28..15.53 rows=13 width=8) (actual time=0.010..0.025 rows=6 loops=2)

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

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

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

CTE inboxes

9. 0.457 124.144 ↓ 1.8 9 1

CTE Scan on users (cost=0.00..2,367.93 rows=5 width=52) (actual time=12.382..124.144 rows=9 loops=1)

10.          

SubPlan (forCTE Scan)

11. 0.739 91.476 ↑ 1.0 1 9

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

12.          

Initplan (forAggregate)

13. 0.017 0.017 ↑ 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.016..0.017 rows=1 loops=1)

  • Index Cond: ((email)::text = 'crm@ostrovok.ru'::text)
14. 90.720 90.720 ↓ 544.0 544 9

Index Only Scan using idx_inbox_desktop_4 on tickets_ticketsimple (cost=0.43..4.49 rows=1 width=0) (actual time=1.659..10.080 rows=544 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: 4894
15. 0.090 0.837 ↑ 1.0 1 9

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

16. 0.747 0.747 ↑ 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.017..0.083 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: 414
17. 0.099 31.374 ↑ 1.0 1 9

Aggregate (cost=439.25..439.26 rows=1 width=32) (actual time=3.486..3.486 rows=1 loops=9)

18. 0.374 31.275 ↓ 16.0 16 9

Nested Loop (cost=0.85..439.24 rows=1 width=4) (actual time=0.813..3.475 rows=16 loops=9)

19. 20.331 20.331 ↓ 2.6 168 9

Index Scan using crm_asterisk_evaluation_e8701ad4 on crm_asterisk_evaluation e (cost=0.42..282.28 rows=64 width=8) (actual time=0.021..2.259 rows=168 loops=9)

  • Index Cond: (user_id = users.user_id)
  • Filter: ((related_to_model)::text = 'Inbox'::text)
  • Rows Removed by Filter: 330
20. 10.570 10.570 ↓ 0.0 0 1,510

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

  • 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. 124.165 124.165 ↓ 1.8 9 1

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

22. 0.063 0.063 ↑ 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.007..0.007 rows=1 loops=9)

  • Index Cond: (id = inboxes.user_id)
Planning time : 2.299 ms
Execution time : 124.584 ms