explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fpt6

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 1,042.450 ↓ 13.0 13 1

Limit (cost=173,069.21..173,069.22 rows=1 width=12,637) (actual time=1,042.441..1,042.450 rows=13 loops=1)

2. 0.055 1,042.444 ↓ 13.0 13 1

Sort (cost=173,069.21..173,069.22 rows=1 width=12,637) (actual time=1,042.440..1,042.444 rows=13 loops=1)

  • Sort Key: activities.""sortOrder"", activities.id
  • Sort Method: quicksort Memory: 34kB
3. 0.024 1,042.389 ↓ 13.0 13 1

Nested Loop Left Join (cost=172,957.56..173,069.20 rows=1 width=12,637) (actual time=1,041.668..1,042.389 rows=13 loops=1)

4. 0.040 1,042.365 ↓ 13.0 13 1

Nested Loop Left Join (cost=172,957.41..173,068.59 rows=1 width=12,481) (actual time=1,041.662..1,042.365 rows=13 loops=1)

  • Join Filter: (activity_participants_metrics.""activityParticipantsUuid"" = activity_participants.uuid)
  • Rows Removed by Join Filter: 13
5. 0.036 0.817 ↓ 13.0 13 1

Nested Loop Left Join (cost=45.13..156.10 rows=1 width=12,465) (actual time=0.158..0.817 rows=13 loops=1)

  • Join Filter: (aagp_cs.id = aagp.""completionStatusId"")
  • Rows Removed by Join Filter: 39
6. 0.011 0.768 ↓ 13.0 13 1

Nested Loop Left Join (cost=45.13..154.49 rows=1 width=12,454) (actual time=0.153..0.768 rows=13 loops=1)

  • Join Filter: (aagp.""userId"" = activity_participants.""userId"")
7. 0.024 0.744 ↓ 13.0 13 1

Nested Loop Left Join (cost=44.57..152.13 rows=1 width=12,495) (actual time=0.151..0.744 rows=13 loops=1)

8. 0.022 0.720 ↓ 13.0 13 1

Nested Loop Left Join (cost=44.15..149.31 rows=1 width=12,415) (actual time=0.149..0.720 rows=13 loops=1)

9. 0.022 0.698 ↓ 13.0 13 1

Nested Loop Left Join (cost=44.01..148.95 rows=1 width=10,867) (actual time=0.148..0.698 rows=13 loops=1)

10. 0.021 0.676 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.73..147.45 rows=1 width=10,532) (actual time=0.144..0.676 rows=13 loops=1)

11. 0.021 0.655 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.59..146.57 rows=1 width=10,016) (actual time=0.143..0.655 rows=13 loops=1)

12. 0.024 0.634 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.45..145.69 rows=1 width=9,500) (actual time=0.140..0.634 rows=13 loops=1)

13. 0.022 0.610 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.30..144.81 rows=1 width=8,984) (actual time=0.138..0.610 rows=13 loops=1)

14. 0.020 0.588 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.16..143.93 rows=1 width=7,948) (actual time=0.136..0.588 rows=13 loops=1)

15. 0.020 0.568 ↓ 13.0 13 1

Nested Loop Left Join (cost=43.02..143.06 rows=1 width=6,916) (actual time=0.134..0.568 rows=13 loops=1)

16. 0.017 0.548 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.87..142.18 rows=1 width=6,400) (actual time=0.133..0.548 rows=13 loops=1)

17. 0.021 0.518 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.73..141.29 rows=1 width=6,316) (actual time=0.131..0.518 rows=13 loops=1)

18. 0.014 0.471 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.58..140.41 rows=1 width=5,800) (actual time=0.126..0.471 rows=13 loops=1)

19. 0.020 0.431 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.44..139.53 rows=1 width=5,284) (actual time=0.122..0.431 rows=13 loops=1)

20. 0.013 0.411 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.29..138.65 rows=1 width=4,768) (actual time=0.121..0.411 rows=13 loops=1)

21. 0.015 0.385 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.15..137.77 rows=1 width=4,252) (actual time=0.119..0.385 rows=13 loops=1)

22. 0.020 0.344 ↓ 13.0 13 1

Nested Loop Left Join (cost=42.00..136.89 rows=1 width=3,736) (actual time=0.115..0.344 rows=13 loops=1)

23. 0.032 0.298 ↓ 13.0 13 1

Nested Loop Left Join (cost=41.86..136.01 rows=1 width=3,220) (actual time=0.111..0.298 rows=13 loops=1)

  • Join Filter: (completion_statuses.id = activity_participants.""completionStatusId"")
  • Rows Removed by Join Filter: 26
24. 0.020 0.240 ↓ 13.0 13 1

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

25. 0.023 0.220 ↓ 13.0 13 1

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

26. 0.041 0.171 ↓ 13.0 13 1

Hash Join (cost=41.59..133.63 rows=1 width=3,080) (actual time=0.098..0.171 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))
27. 0.065 0.065 ↑ 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.023..0.065 rows=25 loops=1)

  • Index Cond: (""userId"" = '24a8398514996d6da25375deccf74170f8770f52'::text)
28. 0.022 0.065 ↑ 1.9 13 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
29. 0.043 0.043 ↑ 1.9 13 1

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

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

SubPlan (for Hash Join)

31. 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[]))
32. 0.026 0.026 ↑ 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.001..0.002 rows=1 loops=13)

  • Index Cond: (id = activity_participants.""createdReasonId"")
33. 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"")
34. 0.026 0.026 ↑ 1.0 3 13

Seq Scan on completion_statuses (cost=0.00..1.30 rows=3 width=19) (actual time=0.001..0.002 rows=3 loops=13)

35. 0.026 0.026 ↑ 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.001..0.002 rows=1 loops=13)

  • Index Cond: (activities.""prefixId"" = id)
36. 0.026 0.026 ↑ 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.001..0.002 rows=1 loops=13)

  • Index Cond: (activities.""activityTypeId"" = id)
37. 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)
38. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""completionLabelId"" = id)
39. 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.001..0.002 rows=1 loops=13)

  • Index Cond: (activities.""contentTypeId"" = id)
40. 0.026 0.026 ↑ 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.001..0.002 rows=1 loops=13)

  • Index Cond: (activities.""reportingTypeId"" = id)
41. 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)
42. 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)
43. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""activityMetricUuid"" = uuid)
44. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""activityUnitUuid"" = uuid)
45. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""activityCategoryUuid"" = uuid)
46. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""activitySubcategoryUuid"" = uuid)
47. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""activityKindUuid"" = uuid)
48. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=13)

  • Index Cond: (activities.""activityHealthMeasureId"" = id)
49. 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)
50. 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)
51. 0.013 0.013 ↓ 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.001 rows=0 loops=13)

  • Index Cond: ((""userId"" = '24a8398514996d6da25375deccf74170f8770f52'::text) AND (""activityGroupId"" = aag.id))
52. 0.013 0.013 ↑ 1.0 3 13

Seq Scan on completion_statuses aagp_cs (cost=0.00..1.30 rows=3 width=19) (actual time=0.000..0.001 rows=3 loops=13)

53. 0.013 1,041.508 ↑ 1.0 1 13

Limit (cost=172,912.29..172,912.29 rows=1 width=32) (actual time=80.115..80.116 rows=1 loops=13)

54. 432.932 1,041.495 ↑ 1,449,456.0 1 13

Sort (cost=172,912.29..176,535.93 rows=1,449,456 width=32) (actual time=80.115..80.115 rows=1 loops=13)

  • Sort Key: activity_participants_metrics.""createdAt"" DESC
  • Sort Method: top-N heapsort Memory: 25kB
55. 608.563 608.563 ↓ 1.0 1,450,391 1

Index Only Scan using activity_participants_metrics_3columns on activity_participants_metrics (cost=0.43..165,665.01 rows=1,449,456 width=32) (actual time=0.016..608.563 rows=1,450,391 loops=1)

  • Heap Fetches: 135473
56. 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)