explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CgN9 : Query Coverage

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 2.964 ↓ 0.0 0 1

Limit (cost=10,996.33..10,996.33 rows=1 width=190) (actual time=2.963..2.964 rows=0 loops=1)

2. 0.020 2.962 ↓ 0.0 0 1

Sort (cost=10,996.33..10,996.33 rows=1 width=190) (actual time=2.962..2.962 rows=0 loops=1)

  • Sort Key: (concat(users.name, ' ', users.last_name)), stores.name
  • Sort Method: quicksort Memory: 25kB
3. 0.001 2.942 ↓ 0.0 0 1

Nested Loop Left Join (cost=228.79..10,996.32 rows=1 width=190) (actual time=2.941..2.942 rows=0 loops=1)

  • Join Filter: ((executions.store_uuid = stores.uuid) AND ((executions.user_uuid)::text = (users.uuid)::text))
4. 0.001 2.941 ↓ 0.0 0 1

Nested Loop Left Join (cost=194.42..210.51 rows=1 width=160) (actual time=2.941..2.941 rows=0 loops=1)

5. 0.000 2.940 ↓ 0.0 0 1

Nested Loop Left Join (cost=194.14..210.21 rows=1 width=165) (actual time=2.940..2.940 rows=0 loops=1)

6. 0.001 2.940 ↓ 0.0 0 1

Nested Loop (cost=193.85..209.91 rows=1 width=167) (actual time=2.940..2.940 rows=0 loops=1)

7. 0.000 2.939 ↓ 0.0 0 1

Nested Loop (cost=193.43..201.47 rows=1 width=95) (actual time=2.939..2.939 rows=0 loops=1)

8. 0.001 2.939 ↓ 0.0 0 1

Group (cost=193.01..193.02 rows=1 width=32) (actual time=2.939..2.939 rows=0 loops=1)

  • Group Key: activity_assignations.user_uuid, activity_assignations.store_uuid
9. 0.005 2.938 ↓ 0.0 0 1

Sort (cost=193.01..193.02 rows=1 width=32) (actual time=2.938..2.938 rows=0 loops=1)

  • Sort Key: activity_assignations.user_uuid, activity_assignations.store_uuid
  • Sort Method: quicksort Memory: 25kB
10. 0.000 2.933 ↓ 0.0 0 1

Nested Loop (cost=1.69..193.00 rows=1 width=32) (actual time=2.933..2.933 rows=0 loops=1)

11. 0.001 2.933 ↓ 0.0 0 1

Nested Loop (cost=1.40..184.68 rows=1 width=64) (actual time=2.933..2.933 rows=0 loops=1)

12. 0.001 2.932 ↓ 0.0 0 1

Nested Loop (cost=0.98..176.23 rows=1 width=64) (actual time=2.932..2.932 rows=0 loops=1)

13. 2.931 2.931 ↓ 0.0 0 1

Index Only Scan using activity_assignations_unique_active on activity_assignations (cost=0.56..24.00 rows=18 width=64) (actual time=2.931..2.931 rows=0 loops=1)

  • Index Cond: ((company_uuid = '38836b91-5616-4698-ac9d-4a147c255002'::uuid) AND (activity_uuid = '9c71adfd-5b88-4186-a4e5-96d16ecddaf0'::uuid))
  • Heap Fetches: 0
14. 0.000 0.000 ↓ 0.0 0

Index Scan using index_users_on_uuid on users users_1 (cost=0.42..8.45 rows=1 width=74) (never executed)

  • Index Cond: ((uuid)::text = (activity_assignations.user_uuid)::text)
  • Filter: (active AND ((permission)::text = ANY ('{analyst_auditor,admin,auditor,gatekeeper}'::text[])) AND ((activity_assignations.company_uuid)::text = (company_uuid)::text))
15. 0.000 0.000 ↓ 0.0 0

Index Scan using index_stores_on_uuid on stores stores_1 (cost=0.42..8.44 rows=1 width=16) (never executed)

  • Index Cond: (uuid = activity_assignations.store_uuid)
  • Filter: active
16. 0.000 0.000 ↓ 0.0 0

Index Scan using index_activities_on_uuid on activities (cost=0.29..8.31 rows=1 width=32) (never executed)

  • Index Cond: (uuid = '9c71adfd-5b88-4186-a4e5-96d16ecddaf0'::uuid)
  • Filter: (active AND ((state)::text = ANY ('{published,unpublished}'::text[])) AND (company_uuid = '38836b91-5616-4698-ac9d-4a147c255002'::uuid) AND (enum_activity_type = 0))
17. 0.000 0.000 ↓ 0.0 0

Index Scan using index_users_on_uuid on users (cost=0.42..8.44 rows=1 width=79) (never executed)

  • Index Cond: ((uuid)::text = (activity_assignations.user_uuid)::text)
18. 0.000 0.000 ↓ 0.0 0

Index Scan using index_stores_on_uuid on stores (cost=0.42..8.44 rows=1 width=88) (never executed)

  • Index Cond: (uuid = activity_assignations.store_uuid)
  • Filter: active
19. 0.000 0.000 ↓ 0.0 0

Index Scan using index_brands_on_uuid on brands (cost=0.28..0.30 rows=1 width=30) (never executed)

  • Index Cond: (uuid = stores.brand_uuid)
  • Filter: active
20. 0.000 0.000 ↓ 0.0 0

Index Scan using index_zones_on_uuid on zones (cost=0.28..0.30 rows=1 width=27) (never executed)

  • Index Cond: (uuid = stores.zone_uuid)
  • Filter: active
21. 0.000 0.000 ↓ 0.0 0

GroupAggregate (cost=34.37..10,785.77 rows=1 width=48) (never executed)

  • Group Key: executions.user_uuid, executions.store_uuid
22. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=34.37..10,785.75 rows=1 width=36) (never executed)

23. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=33.95..10,777.29 rows=1 width=52) (never executed)

24. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=33.66..10,768.97 rows=1 width=68) (never executed)

  • Join Filter: (executions.store_uuid = stores_2.uuid)
25. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=33.24..10,760.69 rows=1 width=100) (never executed)

26. 0.000 0.000 ↓ 0.0 0

Merge Join (cost=32.68..32.84 rows=1 width=84) (never executed)

  • Merge Cond: ((executions.user_uuid = activity_assignations_2.user_uuid) AND (executions.store_uuid = activity_assignations_2.store_uuid))
27. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.31..8.31 rows=2 width=68) (never executed)

  • Sort Key: executions.user_uuid, executions.store_uuid
28. 0.000 0.000 ↓ 0.0 0

Append (cost=0.00..8.30 rows=2 width=68) (never executed)

29. 0.000 0.000 ↓ 0.0 0

Seq Scan on executions (cost=0.00..0.00 rows=1 width=68) (never executed)

  • Filter: ((started_at >= '2020-06-22 05:00:00'::timestamp without time zone) AND (started_at <= '2020-06-23 04:59:59'::timestamp without time zone) AND (company_uuid = '38836b91-5616-4698-ac9d-4a147c255002'::uuid) AND (activity_uuid = '9c71adfd-5b88-4186-a4e5-96d16ecddaf0'::uuid) AND (activity_type_id = 1))
30. 0.000 0.000 ↓ 0.0 0

Index Scan using executions_38836b91_202006_company_date_activity_store_user on executions_38836b91_202006 (cost=0.27..8.30 rows=1 width=68) (never executed)

  • Index Cond: ((company_uuid = '38836b91-5616-4698-ac9d-4a147c255002'::uuid) AND (started_at >= '2020-06-22 05:00:00'::timestamp without time zone) AND (started_at <= '2020-06-23 04:59:59'::timestamp without time zone) AND (activity_type_id = 1) AND (activity_uuid = '9c71adfd-5b88-4186-a4e5-96d16ecddaf0'::uuid))
31. 0.000 0.000 ↓ 0.0 0

Sort (cost=24.37..24.42 rows=18 width=64) (never executed)

  • Sort Key: activity_assignations_2.user_uuid, activity_assignations_2.store_uuid
32. 0.000 0.000 ↓ 0.0 0

Index Only Scan using activity_assignations_unique_active on activity_assignations activity_assignations_2 (cost=0.56..24.00 rows=18 width=64) (never executed)

  • Index Cond: ((company_uuid = '38836b91-5616-4698-ac9d-4a147c255002'::uuid) AND (activity_uuid = '9c71adfd-5b88-4186-a4e5-96d16ecddaf0'::uuid))
  • Heap Fetches: 0
33. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_activity_assignations_on_company_and_user_and_store on activity_assignations activity_assignations_1 (cost=0.56..12,448.33 rows=1 width=32) (never executed)

  • Index Cond: ((company_uuid = '38836b91-5616-4698-ac9d-4a147c255002'::uuid) AND (store_uuid = executions.store_uuid))
  • Heap Fetches: 0
34. 0.000 0.000 ↓ 0.0 0

Index Scan using index_stores_on_uuid on stores stores_2 (cost=0.42..8.26 rows=1 width=16) (never executed)

  • Index Cond: (uuid = activity_assignations_1.store_uuid)
  • Filter: active
35. 0.000 0.000 ↓ 0.0 0

Index Scan using index_activities_on_uuid on activities activities_1 (cost=0.29..8.31 rows=1 width=32) (never executed)

  • Index Cond: (uuid = '9c71adfd-5b88-4186-a4e5-96d16ecddaf0'::uuid)
  • Filter: (active AND ((state)::text = ANY ('{published,unpublished}'::text[])) AND (company_uuid = '38836b91-5616-4698-ac9d-4a147c255002'::uuid) AND (enum_activity_type = 0))
36. 0.000 0.000 ↓ 0.0 0

Index Scan using index_users_on_uuid on users users_2 (cost=0.42..8.45 rows=1 width=74) (never executed)

  • Index Cond: ((uuid)::text = (executions.user_uuid)::text)
  • Filter: (active AND ((permission)::text = ANY ('{analyst_auditor,admin,auditor,gatekeeper}'::text[])) AND ((executions.company_uuid)::text = (company_uuid)::text))
Planning time : 9,852.438 ms
Execution time : 3.314 ms