explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FqF2

Settings
# exclusive inclusive rows x rows loops node
1. 0.017 7.311 ↓ 4.6 23 1

Sort (cost=142.53..142.54 rows=5 width=44) (actual time=7.309..7.311 rows=23 loops=1)

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

CTE users

3. 0.036 0.414 ↓ 4.6 23 1

Nested Loop (cost=0.56..117.77 rows=5 width=4) (actual time=0.039..0.414 rows=23 loops=1)

4. 0.012 0.243 ↓ 2.6 45 1

Nested Loop (cost=0.28..110.64 rows=17 width=4) (actual time=0.033..0.243 rows=45 loops=1)

5. 0.155 0.155 ↓ 2.0 2 1

Seq Scan on profile_team (cost=0.00..94.92 rows=1 width=4) (actual time=0.025..0.155 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.076 0.076 ↓ 1.7 22 2

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

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

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

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

CTE bookers

9. 0.444 7.183 ↓ 4.6 23 1

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

10.          

SubPlan (forCTE Scan)

11. 0.667 6.739 ↑ 1.0 1 23

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

12. 6.072 6.072 ↓ 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.021..0.264 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: 4519
13. 0.054 7.294 ↓ 4.6 23 1

Nested Loop (cost=0.28..11.60 rows=5 width=44) (actual time=0.479..7.294 rows=23 loops=1)

14. 7.194 7.194 ↓ 4.6 23 1

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

15. 0.046 0.046 ↑ 1.0 1 23

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

  • Index Cond: (id = bookers.user_id)
Planning time : 0.630 ms
Execution time : 7.382 ms