explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VWw

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Result (cost=1,440.21..1,440.22 rows=1 width=32) (actual rows= loops=)

2.          

Initplan (for Result)

3. 0.000 0.000 ↓ 0.0

Aggregate (cost=1,440.19..1,440.20 rows=1 width=32) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=1,429.84..1,430.87 rows=414 width=6,132) (actual rows= loops=)

  • Sort Key: __local_1__.priority, __local_1__.id
5. 0.000 0.000 ↓ 0.0

Subquery Scan on __local_1__ (cost=1,225.61..1,411.84 rows=414 width=6,132) (actual rows= loops=)

  • Filter: ((__local_1__.email)::text ~~ '%gmail%'::text)
6. 0.000 0.000 ↓ 0.0

WindowAgg (cost=1,225.61..1,369.52 rows=3,386 width=6,136) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Sort (cost=1,225.61..1,234.08 rows=3,386 width=62) (actual rows= loops=)

  • Sort Key: (CASE WHEN (users.status = 'rejected'::text) THEN 6 WHEN ((COALESCE(rentals_by_drivers.number, '0'::bigint) > 0) AND (users.status <> 'registered'::text)) THEN 1 WHEN ((users.status = 'registration_pending'::text) AND (users.phone_number IS NOT NULL) AND (users.email IS NOT NULL) AND (users.address IS NOT NULL) AND (user_identifications.id_scan_front_side_id IS NOT NULL) AND (user_driver_licences.dl_scan_front_side_id IS NOT NULL)) THEN 2 WHEN (users.status = 'registration_pending'::text) THEN 3 WHEN (users.status = 'registration_missing'::text) THEN 4 WHEN (COALESCE(rentals_by_drivers.number, '0'::bigint) > 0) THEN 5 ELSE 7 END), (COALESCE(users.updated_at, users.created_at)) DESC
8. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=389.64..1,027.10 rows=3,386 width=62) (actual rows= loops=)

  • Hash Cond: (users.id = rentals_by_drivers.driver_id)
9. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=3.09..572.41 rows=3,386 width=123) (actual rows= loops=)

  • Hash Cond: (users.id = user_face_captures.user_id)
10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=2.34..558.95 rows=3,386 width=123) (actual rows= loops=)

  • Hash Cond: (users.id = user_driver_licences.user_id)
11. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1.13..545.04 rows=3,386 width=119) (actual rows= loops=)

  • Hash Cond: (users.id = user_identifications.user_id)
12. 0.000 0.000 ↓ 0.0

Seq Scan on users (cost=0.00..531.20 rows=3,386 width=115) (actual rows= loops=)

  • Filter: (active AND (phone_number IS NOT NULL))
13. 0.000 0.000 ↓ 0.0

Hash (cost=1.12..1.12 rows=1 width=8) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Subquery Scan on user_identifications (cost=0.14..1.12 rows=1 width=8) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Limit (cost=0.14..1.11 rows=1 width=578) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Index Scan Backward using user_identifications_pkey on user_identifications user_identifications_1 (cost=0.14..12.70 rows=13 width=578) (actual rows= loops=)

  • Filter: active
17. 0.000 0.000 ↓ 0.0

Hash (cost=1.20..1.20 rows=1 width=12) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Subquery Scan on user_driver_licences (cost=0.14..1.20 rows=1 width=12) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Limit (cost=0.14..1.19 rows=1 width=1,110) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Index Scan Backward using user_driver_licences_pkey on user_driver_licences user_driver_licences_1 (cost=0.14..12.70 rows=12 width=1,110) (actual rows= loops=)

  • Filter: active
21. 0.000 0.000 ↓ 0.0

Hash (cost=0.74..0.74 rows=1 width=4) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Subquery Scan on user_face_captures (cost=0.15..0.74 rows=1 width=4) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Limit (cost=0.15..0.73 rows=1 width=26) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Index Scan Backward using user_face_captures_pkey on user_face_captures user_face_captures_1 (cost=0.15..27.62 rows=47 width=26) (actual rows= loops=)

  • Filter: (active AND (rental_id IS NULL))
25. 0.000 0.000 ↓ 0.0

Hash (cost=386.48..386.48 rows=5 width=12) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Subquery Scan on rentals_by_drivers (cost=386.35..386.48 rows=5 width=12) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=386.35..386.43 rows=5 width=12) (actual rows= loops=)

  • Group Key: rentals.driver_id
28. 0.000 0.000 ↓ 0.0

Sort (cost=386.35..386.36 rows=5 width=8) (actual rows= loops=)

  • Sort Key: rentals.driver_id
29. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on rentals (cost=174.02..386.29 rows=5 width=8) (actual rows= loops=)

  • Recheck Cond: (status = ANY ('{confirmed,ongoing}'::text[]))
  • Filter: (SubPlan 1)
30. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on rentals_driver_id_status_idx (cost=0.00..174.01 rows=10 width=0) (actual rows= loops=)

  • Index Cond: (status = ANY ('{confirmed,ongoing}'::text[]))
31.          

SubPlan (for Bitmap Heap Scan)

32. 0.000 0.000 ↓ 0.0

Seq Scan on operation_user_company_locations oucl (cost=0.00..17.70 rows=1 width=1) (actual rows= loops=)

  • Filter: (active AND can_view_rental AND (location_id = rentals.location_id) AND (user_company_id = current_user_company_id()))