explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ziUO

Settings
# exclusive inclusive rows x rows loops node
1. 14,076.527 14,076.527 ↓ 5.0 10 1

CTE Scan on get_person_notifications (cost=3,185.30..3,185.34 rows=2 width=304) (actual time=14,075.613..14,076.527 rows=10 loops=1)

2.          

CTE get_event

3. 0.002 0.128 ↑ 1.0 1 1

Append (cost=0.56..3.58 rows=1 width=737) (actual time=0.127..0.128 rows=1 loops=1)

4. 0.126 0.126 ↑ 1.0 1 1

Index Scan using events_org_part_default_evn_seq_vrange_uidx on events_org_part_default e (cost=0.56..3.58 rows=1 width=737) (actual time=0.126..0.126 rows=1 loops=1)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (event_uuid = 'f20cf6ff-64e4-4a07-a655-2c276bc37ba9'::uuid))
  • Filter: (valid_range @> '2019-09-04 17:12:18+00'::timestamp with time zone)
  • Rows Removed by Filter: 1
5.          

CTE get_response_choices

6. 0.003 0.328 ↑ 20,000.0 1 1

Append (cost=0.42..1,008.53 rows=20,000 width=128) (actual time=0.303..0.328 rows=1 loops=1)

7. 0.025 0.322 ↑ 10,000.0 1 1

Nested Loop (cost=0.42..355.99 rows=10,000 width=128) (actual time=0.302..0.322 rows=1 loops=1)

8. 0.005 0.110 ↑ 1.0 1 1

Nested Loop (cost=0.42..3.47 rows=1 width=986) (actual time=0.093..0.110 rows=1 loops=1)

9. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on get_event e_1 (cost=0.00..0.02 rows=1 width=24) (actual time=0.001..0.002 rows=1 loops=1)

  • Filter: (choices IS NULL)
10. 0.103 0.103 ↑ 1.0 1 1

Index Scan using forms_org_seq_vrange_uidx on forms f (cost=0.42..3.44 rows=1 width=1,021) (actual time=0.088..0.103 rows=1 loops=1)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (form_uuid = e_1.form_uuid))
  • Filter: (valid_range @> e_1.created)
  • Rows Removed by Filter: 2
11. 0.067 0.187 ↑ 10,000.0 1 1

ProjectSet (cost=0.00..52.52 rows=10,000 width=64) (actual time=0.184..0.187 rows=1 loops=1)

12. 0.119 0.120 ↑ 100.0 1 1

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.118..0.120 rows=1 loops=1)

13. 0.001 0.001 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.001 rows=1 loops=1)

14. 0.001 0.003 ↓ 0.0 0 1

Nested Loop (cost=0.00..352.54 rows=10,000 width=128) (actual time=0.003..0.003 rows=0 loops=1)

15. 0.002 0.002 ↓ 0.0 0 1

CTE Scan on get_event e_2 (cost=0.00..0.02 rows=1 width=32) (actual time=0.002..0.002 rows=0 loops=1)

  • Filter: (choices IS NOT NULL)
  • Rows Removed by Filter: 1
16. 0.000 0.000 ↓ 0.0 0

ProjectSet (cost=0.00..52.52 rows=10,000 width=64) (never executed)

17. 0.000 0.000 ↓ 0.0 0

ProjectSet (cost=0.00..0.52 rows=100 width=32) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Result (cost=0.00..0.01 rows=1 width=0) (never executed)

19.          

CTE get_filtered_response_choices

20. 0.002 0.002 ↑ 20,000.0 1 1

CTE Scan on get_response_choices rc (cost=0.00..400.00 rows=20,000 width=128) (actual time=0.001..0.002 rows=1 loops=1)

21.          

CTE get_person_device_notifications

22. 4.066 268.543 ↓ 4,303.5 8,607 1

Unique (cost=1,319.38..1,319.49 rows=2 width=344) (actual time=262.870..268.543 rows=8,607 loops=1)

23. 16.804 264.477 ↓ 4,303.5 8,607 1

Sort (cost=1,319.38..1,319.39 rows=2 width=344) (actual time=262.868..264.477 rows=8,607 loops=1)

  • Sort Key: person_ntfn.recipient_uuid, person_ntfn.notification_uuid, person_ntfn.event_uuid, person_ntfn.parent_ntfn_uuid, (CASE WHEN (person_ntfn.delinked_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN person_ntfn.delinked_date ELSE NULL::timestamp with time zone END), device_ntfn.recipient_uuid, device_ntfn.notification_uuid, (CASE WHEN (device_ntfn.failed_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN device_ntfn.failed_date ELSE NULL::timestamp with time zone END), (CASE WHEN (device_ntfn.delivered_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN device_ntfn.delivered_date ELSE NULL::timestamp with time zone END), (CASE WHEN (((device_response.response)::text <> 'XMATTERS_REMOVE'::text) AND (device_response.received <= '2019-09-04 17:12:18+00'::timestamp with time zone)) THEN device_response.received ELSE NULL::timestamp with time zone END), (CASE WHEN ((device_response.received <= '2019-09-04 17:12:18+00'::timestamp with time zone) AND ((device_response.response)::text <> 'XMATTERS_REMOVE'::text)) THEN 'RESPONDED'::text WHEN (device_ntfn.delivered_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN 'DELIVERED'::text WHEN (device_ntfn.failed_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN 'FAILED'::text WHEN (live_ntfn.pending_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN 'PENDING'::text ELSE ''::text END), (CASE WHEN (live_ntfn.pending_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN live_ntfn.pending_date ELSE NULL::timestamp with time zone END), device_response.response_uuid, ((SubPlan 4)), (CASE WHEN (device_response.received <= '2019-09-04 17:12:18+00'::timestamp with time zone) THEN device_response.received ELSE NULL::timestamp with time zone END), device_response.recipient_type, (NULL::uuid), (NULL::character varying), (NULL::timestamp with time zone), (NULL::character varying)
  • Sort Method: quicksort Memory: 2671kB
24. 0.838 247.673 ↓ 4,303.5 8,607 1

Append (cost=1.90..1,319.37 rows=2 width=344) (actual time=6.167..247.673 rows=8,607 loops=1)

25. 4.004 202.890 ↓ 8,566.0 8,566 1

Nested Loop Left Join (cost=1.90..775.31 rows=1 width=319) (actual time=6.166..202.890 rows=8,566 loops=1)

26.          

Initplan (forNested Loop Left Join)

27. 0.020 0.021 ↑ 1.0 1 1

Aggregate (cost=0.02..0.04 rows=1 width=8) (actual time=0.020..0.021 rows=1 loops=1)

28. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on get_event e_3 (cost=0.00..0.02 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=1)

29. 0.003 0.004 ↑ 1.0 1 1

Aggregate (cost=0.02..0.03 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1)

30. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on get_event e_4 (cost=0.00..0.02 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=1)

31. 0.003 0.004 ↑ 1.0 1 1

Aggregate (cost=0.02..0.04 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1)

32. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on get_event e_5 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.001 rows=1 loops=1)

33. 0.004 0.004 ↑ 1.0 1 1

Aggregate (cost=0.02..0.03 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1)

34. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on get_event e_6 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.000 rows=1 loops=1)

35. 0.015 0.018 ↑ 1.0 1 1

Aggregate (cost=0.02..0.04 rows=1 width=8) (actual time=0.018..0.018 rows=1 loops=1)

36. 0.003 0.003 ↑ 1.0 1 1

CTE Scan on get_event e_7 (cost=0.00..0.02 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=1)

37. 0.004 0.005 ↑ 1.0 1 1

Aggregate (cost=0.02..0.03 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=1)

38. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on get_event e_8 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.001 rows=1 loops=1)

39. 3.334 81.078 ↓ 8,385.0 8,385 1

Nested Loop (cost=1.13..69.71 rows=1 width=128) (actual time=5.177..81.078 rows=8,385 loops=1)

40. 4.515 52.589 ↓ 8,385.0 8,385 1

Nested Loop (cost=0.72..66.41 rows=1 width=72) (actual time=5.089..52.589 rows=8,385 loops=1)

41. 0.997 14.534 ↓ 8,385.0 8,385 1

Nested Loop (cost=0.31..62.96 rows=1 width=24) (actual time=4.983..14.534 rows=8,385 loops=1)

42. 0.006 0.136 ↑ 1.0 1 1

HashAggregate (cost=0.02..0.03 rows=1 width=16) (actual time=0.136..0.136 rows=1 loops=1)

  • Group Key: get_event.event_uuid
43. 0.130 0.130 ↑ 1.0 1 1

CTE Scan on get_event (cost=0.00..0.02 rows=1 width=16) (actual time=0.129..0.130 rows=1 loops=1)

44. 0.758 13.401 ↓ 8,385.0 8,385 1

Append (cost=0.29..62.91 rows=1 width=40) (actual time=4.843..13.401 rows=8,385 loops=1)

45. 12.643 12.643 ↓ 8,385.0 8,385 1

Index Scan using notifications_summary_org_part_454_event_uuid_idx on notifications_summary_org_part_454 live_ntfn (cost=0.29..62.91 rows=1 width=40) (actual time=4.842..12.643 rows=8,385 loops=1)

  • Index Cond: (event_uuid = get_event.event_uuid)
  • Filter: ((created_date >= $13) AND (pending_date <= '2019-09-04 17:12:18+00'::timestamp with time zone) AND (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (category = 'LIVE'::text) AND (created_date <= LEAST('2019-09-04 17:12:18+00'::timestamp with time zone, $12)))
  • Rows Removed by Filter: 12077
46. 0.000 33.540 ↑ 1.0 1 8,385

Append (cost=0.41..3.45 rows=1 width=64) (actual time=0.004..0.004 rows=1 loops=8,385)

47. 33.540 33.540 ↑ 1.0 1 8,385

Index Scan using notifications_summary_org_part_454_pkey on notifications_summary_org_part_454 device_ntfn (cost=0.41..3.44 rows=1 width=64) (actual time=0.004..0.004 rows=1 loops=8,385)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (notification_uuid = live_ntfn.parent_ntfn_uuid))
  • Filter: ((created_date >= $9) AND (category = 'DEVICE'::text) AND (created_date <= LEAST('2019-09-04 17:12:18+00'::timestamp with time zone, $8)))
48. 0.000 25.155 ↑ 1.0 1 8,385

Append (cost=0.41..3.29 rows=1 width=72) (actual time=0.003..0.003 rows=1 loops=8,385)

49. 25.155 25.155 ↑ 1.0 1 8,385

Index Scan using notifications_summary_org_part_454_pkey on notifications_summary_org_part_454 person_ntfn (cost=0.41..3.28 rows=1 width=72) (actual time=0.003..0.003 rows=1 loops=8,385)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (notification_uuid = device_ntfn.parent_ntfn_uuid))
  • Filter: ((created_date >= $11) AND (category = 'PERSON'::text) AND (created_date <= LEAST('2019-09-04 17:12:18+00'::timestamp with time zone, $10)))
50. 100.620 100.620 ↓ 0.0 0 8,385

Index Scan using responses_notification_uuid_idx on responses device_response (cost=0.56..3.58 rows=1 width=63) (actual time=0.012..0.012 rows=0 loops=8,385)

  • Index Cond: (notification_uuid = device_ntfn.notification_uuid)
  • Filter: ((is_visible IS TRUE) AND (valid_range @> '2019-09-04 17:12:18+00'::timestamp with time zone) AND (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid))
51.          

SubPlan (forNested Loop Left Join)

52. 8.566 17.132 ↓ 0.0 0 8,566

HashAggregate (cost=700.50..701.77 rows=127 width=32) (actual time=0.002..0.002 rows=0 loops=8,566)

  • Group Key: get_response_choices.text_response
53. 8.566 8.566 ↓ 0.0 0 8,566

CTE Scan on get_response_choices (cost=0.00..700.00 rows=200 width=32) (actual time=0.001..0.001 rows=0 loops=8,566)

  • Filter: ((lower((device_response.response)::text) = lower(text_response)) OR (lower((device_response.response)::text) = lower(translated_response)))
  • Rows Removed by Filter: 1
54. 0.049 43.945 ↓ 41.0 41 1

Hash Join (cost=516.47..544.03 rows=1 width=303) (actual time=43.918..43.945 rows=41 loops=1)

  • Hash Cond: (COALESCE(rc_1.translated_response, rc_1.text_response) = (pr.response)::text)
55.          

Initplan (forHash Join)

56. 0.006 0.007 ↑ 1.0 1 1

Aggregate (cost=0.02..0.04 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=1)

57. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on get_event e_9 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.001 rows=1 loops=1)

58. 0.004 0.005 ↑ 1.0 1 1

Aggregate (cost=0.02..0.03 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=1)

59. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on get_event e_10 (cost=0.00..0.02 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=1)

60. 0.029 0.038 ↑ 2,000.0 1 1

HashAggregate (cost=450.00..470.00 rows=2,000 width=64) (actual time=0.023..0.038 rows=1 loops=1)

  • Group Key: COALESCE(rc_1.translated_response, rc_1.text_response)
61. 0.009 0.009 ↑ 20,000.0 1 1

CTE Scan on get_filtered_response_choices rc_1 (cost=0.00..400.00 rows=20,000 width=64) (actual time=0.008..0.009 rows=1 loops=1)

62. 0.040 43.846 ↓ 41.0 41 1

Hash (cost=66.39..66.39 rows=1 width=119) (actual time=43.846..43.846 rows=41 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
63. 1.401 43.806 ↓ 41.0 41 1

Nested Loop (cost=0.87..66.39 rows=1 width=119) (actual time=0.937..43.806 rows=41 loops=1)

64. 0.458 8.880 ↓ 3,725.0 3,725 1

Nested Loop (cost=0.31..62.80 rows=1 width=72) (actual time=0.050..8.880 rows=3,725 loops=1)

65. 0.005 0.007 ↑ 1.0 1 1

HashAggregate (cost=0.02..0.03 rows=1 width=16) (actual time=0.006..0.007 rows=1 loops=1)

  • Group Key: get_event_1.event_uuid
66. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on get_event get_event_1 (cost=0.00..0.02 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=1)

67. 0.361 8.415 ↓ 3,725.0 3,725 1

Append (cost=0.29..62.75 rows=1 width=72) (actual time=0.040..8.415 rows=3,725 loops=1)

68. 8.054 8.054 ↓ 3,725.0 3,725 1

Index Scan using notifications_summary_org_part_454_event_uuid_idx on notifications_summary_org_part_454 person_resp_ntfn (cost=0.29..62.75 rows=1 width=72) (actual time=0.039..8.054 rows=3,725 loops=1)

  • Index Cond: (event_uuid = get_event_1.event_uuid)
  • Filter: ((created_date >= $15) AND (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (category = 'PERSON'::text) AND (created_date <= LEAST('2019-09-04 17:12:18+00'::timestamp with time zone, $14)))
  • Rows Removed by Filter: 16737
69. 33.525 33.525 ↓ 0.0 0 3,725

Index Scan using responses_notification_uuid_idx on responses pr (cost=0.56..3.58 rows=1 width=63) (actual time=0.009..0.009 rows=0 loops=3,725)

  • Index Cond: (notification_uuid = person_resp_ntfn.notification_uuid)
  • Filter: ((is_visible IS TRUE) AND (valid_range @> '2019-09-04 17:12:18+00'::timestamp with time zone) AND (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND ((recipient_type)::text = 'PERSON'::text))
70.          

CTE get_teams

71. 0.000 0.000 ↓ 0.0 0

GroupAggregate (cost=7.14..7.17 rows=1 width=56) (never executed)

  • Group Key: team_ntfns.team_ntfn_uuid, team_ntfns.team_parent_ntfn_uuid
72. 0.000 0.000 ↓ 0.0 0

Sort (cost=7.14..7.14 rows=1 width=56) (never executed)

  • Sort Key: team_ntfns.team_ntfn_uuid, team_ntfns.team_parent_ntfn_uuid
73. 0.000 0.000 ↓ 0.0 0

Subquery Scan on team_ntfns (cost=7.09..7.13 rows=1 width=56) (never executed)

74. 0.000 0.000 ↓ 0.0 0

GroupAggregate (cost=7.09..7.12 rows=1 width=72) (never executed)

  • Group Key: en.person_ntfn_uuid, en.team_ntfn_uuid, en.team_parent_ntfn_uuid
75. 0.000 0.000 ↓ 0.0 0

Sort (cost=7.09..7.09 rows=1 width=80) (never executed)

  • Sort Key: en.person_ntfn_uuid, en.team_ntfn_uuid, en.team_parent_ntfn_uuid
76. 0.000 0.000 ↓ 0.0 0

Subquery Scan on en (cost=7.03..7.08 rows=1 width=80) (never executed)

77. 0.000 0.000 ↓ 0.0 0

GroupAggregate (cost=7.03..7.07 rows=1 width=128) (never executed)

  • Group Key: n.person_uuid, n.person_ntfn_uuid, team_ntfn.notification_uuid, team_ntfn.parent_ntfn_uuid
78.          

Initplan (forGroupAggregate)

79. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=0.02..0.04 rows=1 width=8) (never executed)

80. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_event e_11 (cost=0.00..0.02 rows=1 width=8) (never executed)

81. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=0.02..0.03 rows=1 width=8) (never executed)

82. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_event e_12 (cost=0.00..0.02 rows=1 width=8) (never executed)

83. 0.000 0.000 ↓ 0.0 0

Sort (cost=6.96..6.97 rows=1 width=96) (never executed)

  • Sort Key: n.person_uuid, n.person_ntfn_uuid, team_ntfn.notification_uuid, team_ntfn.parent_ntfn_uuid
84. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.41..6.96 rows=1 width=96) (never executed)

85. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_person_device_notifications n (cost=0.00..0.04 rows=2 width=80) (never executed)

86. 0.000 0.000 ↓ 0.0 0

Append (cost=0.41..3.45 rows=1 width=32) (never executed)

87. 0.000 0.000 ↓ 0.0 0

Index Scan using notifications_summary_org_part_454_pkey on notifications_summary_org_part_454 team_ntfn (cost=0.41..3.44 rows=1 width=32) (never executed)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (notification_uuid = n.team_uuid))
  • Filter: ((created_date >= $24) AND (category = 'TEAM'::text) AND (created_date <= LEAST('2019-09-04 17:12:18+00'::timestamp with time zone, $23)))
88.          

CTE get_team_groups

89. 0.000 0.000 ↓ 0.0 0

Recursive Union (cost=0.50..352.23 rows=11 width=74) (never executed)

90. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.50..3.56 rows=1 width=74) (never executed)

91.          

Initplan (forNested Loop)

92. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=0.02..0.04 rows=1 width=8) (never executed)

93. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_event e_13 (cost=0.00..0.02 rows=1 width=8) (never executed)

94. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=0.02..0.03 rows=1 width=8) (never executed)

95. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_event e_14 (cost=0.00..0.02 rows=1 width=8) (never executed)

96. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=0.02..0.03 rows=1 width=16) (never executed)

  • Group Key: get_teams.team_ntfn_uuid
97. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_teams (cost=0.00..0.02 rows=1 width=16) (never executed)

98. 0.000 0.000 ↓ 0.0 0

Append (cost=0.41..3.45 rows=1 width=54) (never executed)

99. 0.000 0.000 ↓ 0.0 0

Index Scan using notifications_summary_org_part_454_pkey on notifications_summary_org_part_454 team_ntfn_1 (cost=0.41..3.44 rows=1 width=54) (never executed)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (notification_uuid = get_teams.team_ntfn_uuid))
  • Filter: ((created_date >= $29) AND (category = 'TEAM'::text) AND (created_date <= LEAST('2019-09-04 17:12:18+00'::timestamp with time zone, $28)))
100. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.48..34.85 rows=1 width=74) (never executed)

101.          

Initplan (forNested Loop)

102. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=0.02..0.04 rows=1 width=8) (never executed)

103. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_event e_15 (cost=0.00..0.02 rows=1 width=8) (never executed)

104. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=0.02..0.03 rows=1 width=8) (never executed)

105. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_event e_16 (cost=0.00..0.02 rows=1 width=8) (never executed)

106. 0.000 0.000 ↓ 0.0 0

WorkTable Scan on get_team_groups tg (cost=0.00..0.20 rows=10 width=36) (never executed)

107. 0.000 0.000 ↓ 0.0 0

Append (cost=0.41..3.45 rows=1 width=54) (never executed)

108. 0.000 0.000 ↓ 0.0 0

Index Scan using notifications_summary_org_part_454_pkey on notifications_summary_org_part_454 n_1 (cost=0.41..3.44 rows=1 width=54) (never executed)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (notification_uuid = tg.parent_ntfn_uuid))
  • Filter: ((created_date >= $31) AND (category = ANY ('{TEAM,GROUP}'::text[])) AND (created_date <= LEAST('2019-09-04 17:12:18+00'::timestamp with time zone, $30)))
109.          

CTE get_targeted_groups

110. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.93..3.99 rows=1 width=168) (never executed)

111.          

Initplan (forNested Loop Left Join)

112. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=0.02..0.03 rows=1 width=8) (never executed)

113. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_event e_17 (cost=0.00..0.02 rows=1 width=8) (never executed)

114. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=0.34..0.35 rows=1 width=88) (never executed)

  • Group Key: team_group.notification_uuid, team_group.recipient_uuid
115. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.26..0.33 rows=1 width=72) (never executed)

  • Join Filter: (team_group.root_uuid = team.team_ntfn_uuid)
116. 0.000 0.000 ↓ 0.0 0

Subquery Scan on team_group (cost=0.26..0.29 rows=1 width=48) (never executed)

  • Filter: (team_group.""row"" = 1)
117. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=0.26..0.28 rows=1 width=60) (never executed)

118. 0.000 0.000 ↓ 0.0 0

Sort (cost=0.26..0.26 rows=1 width=52) (never executed)

  • Sort Key: tg_1.root_uuid, tg_1.group_level DESC
119. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_team_groups tg_1 (cost=0.00..0.25 rows=1 width=52) (never executed)

  • Filter: (category = 'GROUP'::text)
120. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_teams team (cost=0.00..0.02 rows=1 width=40) (never executed)

121. 0.000 0.000 ↓ 0.0 0

Index Scan using groups_org_seq_vrange_uidx on groups g (cost=0.56..3.58 rows=1 width=64) (never executed)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (group_uuid = team_group.recipient_uuid))
  • Filter: ((is_visible IS TRUE) AND (valid_range @> $35))
122.          

CTE get_total_person_uuids

123. 4.857 17.488 ↓ 1,862.5 3,725 1

HashAggregate (cost=0.05..0.07 rows=2 width=24) (actual time=16.694..17.488 rows=3,725 loops=1)

  • Group Key: en_1.person_uuid
124. 12.631 12.631 ↓ 4,303.5 8,607 1

CTE Scan on get_person_device_notifications en_1 (cost=0.00..0.04 rows=2 width=24) (actual time=0.001..12.631 rows=8,607 loops=1)

125.          

CTE get_person_uuids

126. 0.017 19.383 ↓ 10.0 10 1

Limit (cost=0.06..0.06 rows=1 width=24) (actual time=19.378..19.383 rows=10 loops=1)

127. 0.345 19.366 ↓ 15.0 30 1

Sort (cost=0.05..0.06 rows=2 width=24) (actual time=19.363..19.366 rows=30 loops=1)

  • Sort Key: en_agg.delivered_date_min
  • Sort Method: top-N heapsort Memory: 29kB
128. 19.021 19.021 ↓ 1,862.5 3,725 1

CTE Scan on get_total_person_uuids en_agg (cost=0.00..0.04 rows=2 width=24) (actual time=16.697..19.021 rows=3,725 loops=1)

129.          

CTE get_person_notifications

130. 0.009 14,076.469 ↓ 5.0 10 1

Subquery Scan on p (cost=88.31..90.17 rows=2 width=304) (actual time=14,075.605..14,076.469 rows=10 loops=1)

131. 1.161 14,076.460 ↓ 5.0 10 1

GroupAggregate (cost=88.31..90.12 rows=2 width=272) (actual time=14,075.600..14,076.460 rows=10 loops=1)

  • Group Key: get_person_device_notifications.person_uuid, get_person_device_notifications.person_ntfn_uuid, get_person_device_notifications.person_delinked_date, get_person_device_notifications.team_uuid, get_person_device_notifications.event_uuid, get_person_device_notifications.person_response_value, get_person_device_notifications.person_response_received, get_person_device_notifications.person_response_recipient_type
132.          

Initplan (forGroupAggregate)

133. 0.038 0.043 ↑ 1.0 1 1

Aggregate (cost=0.02..0.03 rows=1 width=8) (actual time=0.043..0.043 rows=1 loops=1)

134. 0.005 0.005 ↑ 1.0 1 1

CTE Scan on get_event e_18 (cost=0.00..0.02 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=1)

135. 0.278 14,075.256 ↑ 1.3 27 1

Sort (cost=88.27..88.36 rows=34 width=326) (actual time=14,075.253..14,075.256 rows=27 loops=1)

  • Sort Key: get_person_device_notifications.person_uuid, get_person_device_notifications.person_ntfn_uuid, get_person_device_notifications.person_delinked_date, get_person_device_notifications.team_uuid, get_person_device_notifications.event_uuid, get_person_device_notifications.person_response_value, get_person_device_notifications.person_response_received, get_person_device_notifications.person_response_recipient_type
  • Sort Method: quicksort Memory: 32kB
136. 0.208 14,074.978 ↑ 1.3 27 1

Nested Loop Left Join (cost=0.59..87.41 rows=34 width=326) (actual time=644.563..14,074.978 rows=27 loops=1)

137. 1.138 284.574 ↓ 27.0 27 1

Hash Semi Join (cost=0.03..0.09 rows=1 width=280) (actual time=282.495..284.574 rows=27 loops=1)

  • Hash Cond: (get_person_device_notifications.person_uuid = get_person_uuids.person_uuid)
138. 264.008 264.008 ↓ 4,303.5 8,607 1

CTE Scan on get_person_device_notifications (cost=0.00..0.04 rows=2 width=280) (actual time=262.872..264.008 rows=8,607 loops=1)

139. 0.040 19.428 ↓ 10.0 10 1

Hash (cost=0.02..0.02 rows=1 width=16) (actual time=19.428..19.428 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
140. 19.388 19.388 ↓ 10.0 10 1

CTE Scan on get_person_uuids (cost=0.00..0.02 rows=1 width=16) (actual time=19.381..19.388 rows=10 loops=1)

141. 0.162 13,790.196 ↑ 1.0 1 27

Append (cost=0.56..87.31 rows=1 width=62) (actual time=94.649..510.748 rows=1 loops=27)

142. 13,790.034 13,790.034 ↑ 1.0 1 27

Index Scan using devices_org_part_default_recipient_uuid_idx on devices_org_part_default d (cost=0.56..87.30 rows=1 width=62) (actual time=94.646..510.742 rows=1 loops=27)

  • Index Cond: (recipient_uuid = get_person_device_notifications.device_uuid)
  • Filter: ((is_visible IS TRUE) AND (valid_range @> $40) AND (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid))
  • Rows Removed by Filter: 150
Planning time : 734.629 ms
Execution time : 14,084.815 ms