explain.depesz.com

PostgreSQL's explain analyze made readable

Result: G7fB

Settings
# exclusive inclusive rows x rows loops node
1. 0.090 1,042.929 ↓ 13.0 13 1

Sort (cost=173,041.50..173,041.50 rows=1 width=12,637) (actual time=1,042.921..1,042.929 rows=13 loops=1)

  • Sort Key: activities.""sortOrder"", activities.id
  • Sort Method: quicksort Memory: 34kB
2. 0.036 1,042.839 ↓ 13.0 13 1

Nested Loop Left Join (cost=172,932.52..173,041.49 rows=1 width=12,637) (actual time=1,041.774..1,042.839 rows=13 loops=1)

3. 0.054 1,042.803 ↓ 13.0 13 1

Nested Loop Left Join (cost=172,932.37..173,040.87 rows=1 width=12,481) (actual time=1,041.768..1,042.803 rows=13 loops=1)

  • Join Filter: (activity_participants_metrics.""activityParticipantsUuid"" = activity_participants.uuid)
  • Rows Removed by Join Filter: 13
4. 0.038 1.137 ↓ 13.0 13 1

Nested Loop Left Join (cost=45.39..153.68 rows=1 width=12,465) (actual time=0.170..1.137 rows=13 loops=1)

5. 0.031 1.099 ↓ 13.0 13 1

Nested Loop Left Join (cost=45.26..153.26 rows=1 width=12,454) (actual time=0.167..1.099 rows=13 loops=1)

  • Join Filter: (aagp.""userId"" = activity_participants.""userId"")
6. 0.034 1.068 ↓ 13.0 13 1

Nested Loop Left Join (cost=44.70..150.90 rows=1 width=12,495) (actual time=0.166..1.068 rows=13 loops=1)

7. 0.037 1.034 ↓ 13.0 13 1

Nested Loop Left Join (cost=44.28..148.08 rows=1 width=12,415) (actual time=0.164..1.034 rows=13 loops=1)

8. 0.020 0.997 ↓ 13.0 13 1

Nested Loop Left Join (cost=44.14..147.72 rows=1 width=10,867) (actual time=0.163..0.997 rows=13 loops=1)

9. 0.019 0.964 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.86..146.22 rows=1 width=10,532) (actual time=0.160..0.964 rows=13 loops=1)

10. 0.024 0.932 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.72..145.34 rows=1 width=10,016) (actual time=0.159..0.932 rows=13 loops=1)

11. 0.016 0.895 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.58..144.46 rows=1 width=9,500) (actual time=0.157..0.895 rows=13 loops=1)

12. 0.022 0.866 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.43..143.59 rows=1 width=8,984) (actual time=0.156..0.866 rows=13 loops=1)

13. 0.021 0.831 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.29..142.71 rows=1 width=7,948) (actual time=0.154..0.831 rows=13 loops=1)

14. 0.029 0.797 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.15..141.83 rows=1 width=6,916) (actual time=0.152..0.797 rows=13 loops=1)

15. 0.035 0.768 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.00..140.95 rows=1 width=6,400) (actual time=0.151..0.768 rows=13 loops=1)

16. 0.025 0.720 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.86..140.07 rows=1 width=6,316) (actual time=0.149..0.720 rows=13 loops=1)

17. 0.036 0.656 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.71..139.19 rows=1 width=5,800) (actual time=0.145..0.656 rows=13 loops=1)

18. 0.019 0.594 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.57..138.31 rows=1 width=5,284) (actual time=0.142..0.594 rows=13 loops=1)

19. 0.015 0.562 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.42..137.43 rows=1 width=4,768) (actual time=0.141..0.562 rows=13 loops=1)

20. 0.030 0.534 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.28..136.54 rows=1 width=4,252) (actual time=0.140..0.534 rows=13 loops=1)

21. 0.026 0.465 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.13..135.66 rows=1 width=3,736) (actual time=0.136..0.465 rows=13 loops=1)

22. 0.022 0.400 ↓ 13.0 13 1

Nested Loop Left Join (cost=41.99..134.78 rows=1 width=3,220) (actual time=0.133..0.400 rows=13 loops=1)

23. 0.033 0.339 ↓ 13.0 13 1

Nested Loop Left Join (cost=41.86..134.40 rows=1 width=3,205) (actual time=0.130..0.339 rows=13 loops=1)

24. 0.036 0.306 ↓ 13.0 13 1

Nested Loop Left Join (cost=41.72..134.02 rows=1 width=3,194) (actual time=0.129..0.306 rows=13 loops=1)

25. 0.067 0.231 ↓ 13.0 13 1

Hash Join (cost=41.59..133.63 rows=1 width=3,080) (actual time=0.124..0.231 rows=13 loops=1)

  • Hash Cond: (activity_participants.""activityId"" = activities.id)
  • Join Filter: (((activities.""deletedAt"" IS NULL) AND (activity_participants.""deletedAt"" IS NULL)) OR (hashed SubPlan 1))
26. 0.084 0.084 ↑ 3.0 25 1

Index Scan using activity_participants_userid_index on activity_participants (cost=0.56..92.22 rows=75 width=124) (actual time=0.024..0.084 rows=25 loops=1)

  • Index Cond: (""userId"" = '24a8398514996d6da25375deccf74170f8770f52'::text)
27. 0.038 0.080 ↑ 1.9 13 1

Hash (cost=36.85..36.85 rows=25 width=2,960) (actual time=0.080..0.080 rows=13 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
28. 0.042 0.042 ↑ 1.9 13 1

Index Scan using activity_rootid on activities (cost=0.42..36.85 rows=25 width=2,960) (actual time=0.010..0.042 rows=13 loops=1)

  • Index Cond: (""rootId"" = ANY ('{54318,54324,54304,54310,54312}'::integer[]))
29.          

SubPlan (for Hash Join)

30. 0.000 0.000 ↓ 0.0 0

Seq Scan on deleted_reasons deleted_reasons_1 (cost=0.00..1.61 rows=2 width=4) (never executed)

  • Filter: ((value)::text = ANY ('{EXPIRED,LOST_ELIGIBILITY}'::text[]))
31. 0.039 0.039 ↑ 1.0 1 13

Index Scan using created_reasons_pkey on created_reasons (cost=0.13..0.28 rows=1 width=122) (actual time=0.002..0.003 rows=1 loops=13)

  • Index Cond: (id = activity_participants.""createdReasonId"")
32. 0.000 0.000 ↓ 0.0 0 13

Index Scan using deleted_reasons_pkey on deleted_reasons (cost=0.13..0.28 rows=1 width=19) (actual time=0.000..0.000 rows=0 loops=13)

  • Index Cond: (id = activity_participants.""deletedReasonId"")
33. 0.039 0.039 ↑ 1.0 1 13

Index Scan using completion_statuses_pkey on completion_statuses (cost=0.13..0.28 rows=1 width=19) (actual time=0.002..0.003 rows=1 loops=13)

  • Index Cond: (id = activity_participants.""completionStatusId"")
34. 0.039 0.039 ↑ 1.0 1 13

Index Scan using activity_prefixes_pkey on activity_prefixes (cost=0.14..0.78 rows=1 width=520) (actual time=0.002..0.003 rows=1 loops=13)

  • Index Cond: (activities.""prefixId"" = id)
35. 0.039 0.039 ↑ 1.0 1 13

Index Scan using activity_types_pkey on activity_types (cost=0.14..0.78 rows=1 width=520) (actual time=0.002..0.003 rows=1 loops=13)

  • Index Cond: (activities.""activityTypeId"" = id)
36. 0.013 0.013 ↓ 0.0 0 13

Index Scan using category_types_pkey on category_types (cost=0.14..0.78 rows=1 width=520) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""categoryTypeId"" = id)
37. 0.013 0.013 ↓ 0.0 0 13

Index Scan using completion_labels_pkey on completion_labels (cost=0.14..0.78 rows=1 width=520) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""completionLabelId"" = id)
38. 0.026 0.026 ↑ 1.0 1 13

Index Scan using content_types_pkey on content_types (cost=0.14..0.78 rows=1 width=520) (actual time=0.002..0.002 rows=1 loops=13)

  • Index Cond: (activities.""contentTypeId"" = id)
39. 0.039 0.039 ↑ 1.0 1 13

Index Scan using reporting_types_pkey on reporting_types (cost=0.14..0.78 rows=1 width=520) (actual time=0.002..0.003 rows=1 loops=13)

  • Index Cond: (activities.""reportingTypeId"" = id)
40. 0.013 0.013 ↓ 0.0 0 13

Index Scan using event_activities_pkey on event_activities (cost=0.15..0.78 rows=1 width=84) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""eventActivityId"" = id)
41. 0.000 0.000 ↓ 0.0 0 13

Index Scan using time_units_pkey on time_units fu (cost=0.14..0.78 rows=1 width=520) (actual time=0.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""frequencyUnitId"" = id)
42. 0.013 0.013 ↓ 0.0 0 13

Index Scan using activity_metrics_uuid_unique on activity_metrics metric (cost=0.14..0.78 rows=1 width=1,048) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""activityMetricUuid"" = uuid)
43. 0.013 0.013 ↓ 0.0 0 13

Index Scan using activity_units_uuid_unique on activity_units unit (cost=0.14..0.78 rows=1 width=1,052) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""activityUnitUuid"" = uuid)
44. 0.013 0.013 ↓ 0.0 0 13

Index Scan using activity_categories_uuid_unique on activity_categories category (cost=0.14..0.78 rows=1 width=532) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""activityCategoryUuid"" = uuid)
45. 0.013 0.013 ↓ 0.0 0 13

Index Scan using activity_subcategories_uuid_unique on activity_subcategories (cost=0.14..0.78 rows=1 width=532) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""activitySubcategoryUuid"" = uuid)
46. 0.013 0.013 ↓ 0.0 0 13

Index Scan using activity_kinds_uuid_unique on activity_kinds kind (cost=0.14..0.78 rows=1 width=532) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""activityKindUuid"" = uuid)
47. 0.013 0.013 ↓ 0.0 0 13

Index Scan using activity_health_measures_pkey on activity_health_measures ahm (cost=0.28..1.40 rows=1 width=335) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: (activities.""activityHealthMeasureId"" = id)
48. 0.000 0.000 ↓ 0.0 0 13

Index Scan using activity_health_measure_types_pkey on activity_health_measure_types ahmt (cost=0.14..0.26 rows=1 width=1,552) (actual time=0.000..0.000 rows=0 loops=13)

  • Index Cond: (ahm.""healthMeasureTypeId"" = id)
49. 0.000 0.000 ↓ 0.0 0 13

Index Scan using activity_groups_id_deletedat on activity_groups aag (cost=0.42..2.73 rows=1 width=80) (actual time=0.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""alternativeActivityGroupId"" = id)
50. 0.000 0.000 ↓ 0.0 0 13

Index Scan using unique_userid_activitygroupid_activity_group_participants on activity_group_participants aagp (cost=0.56..2.26 rows=1 width=49) (actual time=0.000..0.000 rows=0 loops=13)

  • Index Cond: ((""userId"" = '24a8398514996d6da25375deccf74170f8770f52'::text) AND (""activityGroupId"" = aag.id))
51. 0.000 0.000 ↓ 0.0 0 13

Index Scan using completion_statuses_pkey on completion_statuses aagp_cs (cost=0.13..0.32 rows=1 width=19) (actual time=0.000..0.000 rows=0 loops=13)

  • Index Cond: (id = aagp.""completionStatusId"")
52. 0.026 1,041.612 ↑ 1.0 1 13

Limit (cost=172,886.99..172,886.99 rows=1 width=32) (actual time=80.123..80.124 rows=1 loops=13)

53. 484.871 1,041.586 ↑ 1,449,456.0 1 13

Sort (cost=172,886.99..176,510.63 rows=1,449,456 width=32) (actual time=80.122..80.122 rows=1 loops=13)

  • Sort Key: activity_participants_metrics.""createdAt"" DESC
  • Sort Method: top-N heapsort Memory: 25kB
54. 556.715 556.715 ↑ 1.0 1,447,677 1

Index Only Scan using activity_participants_metrics_3columns on activity_participants_metrics (cost=0.43..165,639.71 rows=1,449,456 width=32) (actual time=0.012..556.715 rows=1,447,677 loops=1)

  • Heap Fetches: 339
55. 0.000 0.000 ↓ 0.0 0 13

Index Scan using wellsource_hra_settings_pkey on wellsource_hra_settings hra (cost=0.14..0.52 rows=1 width=156) (actual time=0.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""wellsourceHraSettingsId"" = id)