explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FV7m

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 1.033 ↓ 5.0 5 1

Unique (cost=217.14..217.18 rows=1 width=1,195) (actual time=1.023..1.033 rows=5 loops=1)

2. 0.105 1.023 ↓ 5.0 5 1

Sort (cost=217.14..217.15 rows=1 width=1,195) (actual time=1.022..1.023 rows=5 loops=1)

  • Sort Key: u.id, u.sales_email_pref, u.login, u.first_name, u.last_name, u.email, u.lang_key, np.restaurantunit_id, c.id, c.name, ru.name, ru.tenant_id, ((date_part('hour'::text, timezone((ru.unit_tz)::text, CURRENT_TIMESTAMP)) >= (ru.sales_email_hour)::double precision)), (date_part('doy'::text, timezone((ru.unit_tz)::text, CURRENT_TIMESTAMP)))
  • Sort Method: quicksort Memory: 26kB
3. 0.056 0.918 ↓ 5.0 5 1

Nested Loop (cost=13.60..217.13 rows=1 width=1,195) (actual time=0.228..0.918 rows=5 loops=1)

  • Join Filter: (ru.concept_id = c.id)
  • Rows Removed by Join Filter: 20
4. 0.046 0.847 ↓ 5.0 5 1

Nested Loop (cost=13.60..216.00 rows=1 width=792) (actual time=0.196..0.847 rows=5 loops=1)

  • Join Filter: ((u.id = npu.user_id) OR (((ua.authority_name)::text = (npr.authority_name)::text) AND (ua.unit_id = np.restaurantunit_id)) OR (((ua.authority_name)::text = ANY ('{ROLE_UNIT_MANAGER,ROLE_UNIT_ADMIN,ROLE_USER,ROLE_ACCOUNTANT}'::text[])) AND ((npa.actors)::text = 'ALL_USERS'::text) AND (ua.unit_id = np.restaurantunit_id) AND u.activated AND (u.retired_date IS NULL)))
  • Rows Removed by Join Filter: 57
5. 0.017 0.601 ↓ 20.0 40 1

Nested Loop (cost=13.32..212.37 rows=2 width=1,045) (actual time=0.114..0.601 rows=40 loops=1)

6. 0.002 0.518 ↓ 2.0 2 1

Nested Loop (cost=13.32..199.77 rows=1 width=976) (actual time=0.105..0.518 rows=2 loops=1)

  • Join Filter: (np.restaurantunit_id = ru.id)
  • Rows Removed by Join Filter: 1
7. 0.007 0.454 ↓ 2.0 2 1

Nested Loop Left Join (cost=13.06..191.48 rows=1 width=252) (actual time=0.056..0.454 rows=2 loops=1)

8. 0.007 0.439 ↓ 2.0 2 1

Nested Loop Left Join (cost=8.72..176.50 rows=1 width=252) (actual time=0.047..0.439 rows=2 loops=1)

9. 0.009 0.422 ↓ 2.0 2 1

Nested Loop Left Join (cost=4.36..148.89 rows=1 width=134) (actual time=0.037..0.422 rows=2 loops=1)

10. 0.393 0.393 ↓ 2.0 2 1

Seq Scan on t_notification_preferences np (cost=0.00..121.28 rows=1 width=16) (actual time=0.019..0.393 rows=2 loops=1)

  • Filter: ((retired_date IS NULL) AND ((notification_type)::text = 'SALES'::text))
  • Rows Removed by Filter: 10
11. 0.008 0.020 ↑ 10.0 1 2

Bitmap Heap Scan on t_notification_preferences_actors npa (cost=4.36..27.51 rows=10 width=126) (actual time=0.009..0.010 rows=1 loops=2)

  • Recheck Cond: (notificationpreferences_id = np.id)
  • Heap Blocks: exact=2
12. 0.012 0.012 ↑ 10.0 1 2

Bitmap Index Scan on t_notification_preferences_actors_pkey (cost=0.00..4.36 rows=10 width=0) (actual time=0.006..0.006 rows=1 loops=2)

  • Index Cond: (notificationpreferences_id = np.id)
13. 0.002 0.010 ↓ 0.0 0 2

Bitmap Heap Scan on t_notification_preferences_roles npr (cost=4.36..27.51 rows=10 width=126) (actual time=0.005..0.005 rows=0 loops=2)

  • Recheck Cond: (notificationpreferences_id = np.id)
14. 0.008 0.008 ↓ 0.0 0 2

Bitmap Index Scan on t_notification_preferences_roles_pkey (cost=0.00..4.36 rows=10 width=0) (actual time=0.004..0.004 rows=0 loops=2)

  • Index Cond: (notificationpreferences_id = np.id)
15. 0.002 0.008 ↓ 0.0 0 2

Bitmap Heap Scan on t_notification_preferences_user npu (cost=4.35..14.89 rows=9 width=16) (actual time=0.004..0.004 rows=0 loops=2)

  • Recheck Cond: (notificationpreferences_id = np.id)
16. 0.006 0.006 ↓ 0.0 0 2

Bitmap Index Scan on t_notification_preferences_user_pkey (cost=0.00..4.34 rows=9 width=0) (actual time=0.003..0.003 rows=0 loops=2)

  • Index Cond: (notificationpreferences_id = np.id)
17. 0.062 0.062 ↓ 2.0 2 2

Index Scan using uq_restaurantunit_name on t_restaurantunit ru (cost=0.26..8.28 rows=1 width=732) (actual time=0.029..0.031 rows=2 loops=2)

  • Filter: (((unit_status)::text <> ALL ('{CLOSED,FIRED,FAILED_TO_LAUNCH}'::text[])) OR (unit_status IS NULL))
18. 0.066 0.066 ↑ 9.0 20 2

Seq Scan on t_user u (cost=0.00..10.80 rows=180 width=69) (actual time=0.005..0.033 rows=20 loops=2)

19. 0.200 0.200 ↑ 3.0 2 40

Index Only Scan using t_user_authority_pkey on t_user_authority ua (cost=0.28..1.65 rows=6 width=134) (actual time=0.004..0.005 rows=2 loops=40)

  • Index Cond: (user_id = u.id)
  • Heap Fetches: 62
20. 0.015 0.015 ↑ 1.0 5 5

Seq Scan on t_concept c (cost=0.00..1.05 rows=5 width=524) (actual time=0.003..0.003 rows=5 loops=5)

Planning time : 7.651 ms
Execution time : 1.547 ms