explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jIUp

Settings
# exclusive inclusive rows x rows loops node
1. 0.073 1,061.156 ↓ 2.9 23 1

Sort (cost=145.11..145.13 rows=8 width=48) (actual time=1,061.152..1,061.156 rows=23 loops=1)

  • Sort Key: bookers.bookings DESC
  • Sort Method: quicksort Memory: 26kB
2.          

CTE users

3. 0.051 3.854 ↓ 4.6 23 1

Nested Loop (cost=0.56..117.46 rows=5 width=4) (actual time=0.118..3.854 rows=23 loops=1)

4. 0.025 3.263 ↓ 2.8 45 1

Nested Loop (cost=0.28..110.65 rows=16 width=4) (actual time=0.092..3.263 rows=45 loops=1)

5. 2.860 2.860 ↓ 2.0 2 1

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

  • Filter: (is_active AND ((team_uid)::text = ANY ('{inbound_group_day_shift_1,inbound_group_day_shift_2}'::text[])))
  • Rows Removed by Filter: 232
6. 0.378 0.378 ↓ 1.7 22 2

Index Scan using profile_userconfig_f6a7ca40 on profile_userconfig profile_userconfig_1 (cost=0.28..15.59 rows=13 width=8) (actual time=0.021..0.189 rows=22 loops=2)

  • Index Cond: (team_id = profile_team.id)
7. 0.540 0.540 ↑ 1.0 1 45

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

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

CTE bookers

9. 3.971 1,060.223 ↓ 4.6 23 1

CTE Scan on users (cost=0.00..13.10 rows=5 width=12) (actual time=73.018..1,060.223 rows=23 loops=1)

10.          

SubPlan (forCTE Scan)

11. 1.150 1,056.252 ↑ 1.0 1 23

Aggregate (cost=2.59..2.60 rows=1 width=8) (actual time=45.924..45.924 rows=1 loops=23)

12. 1,055.102 1,055.102 ↓ 198.0 198 23

Index Only Scan using idx_order_created_by_user_source on orders_order (cost=0.56..2.59 rows=1 width=0) (actual time=0.468..45.874 rows=198 loops=23)

  • Index Cond: ((created_by_user_id = users.user_id) AND (source = 'moto-inbound'::text) AND (created_date_time >= '2019-01-01 00:00:00+00'::timestamp with time zone) AND (created_date_time <= '2019-06-01 00:00:00+00'::timestamp with time zone))
  • Heap Fetches: 4526
13. 0.180 1,061.083 ↓ 2.9 23 1

Nested Loop (cost=0.69..14.43 rows=8 width=48) (actual time=73.099..1,061.083 rows=23 loops=1)

  • Join Filter: (bookers.user_id = auth_user.id)
14. 0.089 1,060.765 ↓ 4.6 23 1

Nested Loop (cost=0.41..12.22 rows=5 width=20) (actual time=73.066..1,060.765 rows=23 loops=1)

15. 1,060.262 1,060.262 ↓ 4.6 23 1

CTE Scan on bookers (cost=0.00..0.10 rows=5 width=12) (actual time=73.023..1,060.262 rows=23 loops=1)

16. 0.414 0.414 ↑ 1.0 1 23

Index Scan using profile_userconfig_user_id_key on profile_userconfig (cost=0.41..2.42 rows=1 width=8) (actual time=0.018..0.018 rows=1 loops=23)

  • Index Cond: (user_id = bookers.user_id)
17. 0.138 0.138 ↑ 1.0 1 23

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

  • Index Cond: (id = profile_userconfig.user_id)