explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bph3

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 988.803 ↑ 20.9 10 1

Sort (cost=1,355,810.28..1,355,810.80 rows=209 width=256) (actual time=988.802..988.803 rows=10 loops=1)

  • Sort Key: get_person_uuids.last_response DESC NULLS LAST, (min(pn.device_delivered_date_min)) DESC
  • Sort Method: quicksort Memory: 44kB
2.          

CTE get_event

3. 0.002 0.181 ↑ 1.0 1 1

Append (cost=0.56..3.58 rows=1 width=737) (actual time=0.179..0.181 rows=1 loops=1)

4. 0.179 0.179 ↑ 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.178..0.179 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.002 0.451 ↑ 20,000.0 1 1

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

7. 0.013 0.446 ↑ 10,000.0 1 1

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

8. 0.006 0.183 ↑ 1.0 1 1

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

9. 0.003 0.003 ↑ 1.0 1 1

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

  • Filter: (choices IS NULL)
10. 0.174 0.174 ↑ 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.147..0.174 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.086 0.250 ↑ 10,000.0 1 1

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

12. 0.163 0.164 ↑ 100.0 1 1

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.163..0.164 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.021 0.067 ↑ 10,000.0 1 1

Hash Join (cost=603.36..1,167.11 rows=10,000 width=128) (actual time=0.065..0.067 rows=1 loops=1)

  • Hash Cond: (rc.text_response = rc2.text_response)
21. 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.002..0.002 rows=1 loops=1)

22. 0.009 0.044 ↑ 127.0 1 1

Hash (cost=601.77..601.77 rows=127 width=32) (actual time=0.044..0.044 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
23. 0.008 0.035 ↑ 127.0 1 1

HashAggregate (cost=600.50..601.77 rows=127 width=32) (actual time=0.035..0.035 rows=1 loops=1)

  • Group Key: rc2.text_response
24. 0.027 0.027 ↑ 200.0 1 1

CTE Scan on get_response_choices rc2 (cost=0.00..600.00 rows=200 width=32) (actual time=0.027..0.027 rows=1 loops=1)

  • Filter: ((lower(translated_response) = 'acknowledge'::text) OR (lower(text_response) = 'acknowledge'::text))
25.          

CTE get_person_device_notifications

26. 6.730 681.577 ↓ 4,303.5 8,607 1

Unique (cost=1,080.60..1,080.71 rows=2 width=344) (actual time=672.276..681.577 rows=8,607 loops=1)

27. 24.836 674.847 ↓ 4,303.5 8,607 1

Sort (cost=1,080.60..1,080.61 rows=2 width=344) (actual time=672.272..674.847 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
28. 1.741 650.011 ↓ 4,303.5 8,607 1

Append (cost=1.90..1,080.59 rows=2 width=344) (actual time=19.137..650.011 rows=8,607 loops=1)

29. 30.697 536.512 ↓ 8,566.0 8,566 1

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

30.          

Initplan (forNested Loop Left Join)

31. 0.005 0.006 ↑ 1.0 1 1

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

32. 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)

33. 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)

34. 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)

35. 0.004 0.005 ↑ 1.0 1 1

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

36. 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.001..0.001 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.005..0.005 rows=1 loops=1)

38. 0.001 0.001 ↑ 1.0 1 1

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

39. 0.027 0.032 ↑ 1.0 1 1

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

40. 0.005 0.005 ↑ 1.0 1 1

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

41. 0.005 0.006 ↑ 1.0 1 1

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

42. 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.001..0.001 rows=1 loops=1)

43. 1.895 203.172 ↓ 8,385.0 8,385 1

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

44. 17.303 142.582 ↓ 8,385.0 8,385 1

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

45. 1.635 41.429 ↓ 8,385.0 8,385 1

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

46. 0.008 0.193 ↑ 1.0 1 1

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

  • Group Key: get_event.event_uuid
47. 0.185 0.185 ↑ 1.0 1 1

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

48. 1.485 39.601 ↓ 8,385.0 8,385 1

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

49. 38.116 38.116 ↓ 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=18.114..38.116 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
50. 8.385 83.850 ↑ 1.0 1 8,385

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

51. 75.465 75.465 ↑ 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.009..0.009 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)))
52. 8.385 58.695 ↑ 1.0 1 8,385

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

53. 50.310 50.310 ↑ 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.006..0.006 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)))
54. 268.320 268.320 ↓ 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.032..0.032 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))
55.          

SubPlan (forNested Loop Left Join)

56. 8.566 34.264 ↓ 0.0 0 8,566

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

  • Group Key: get_response_choices.text_response
57. 25.698 25.698 ↓ 0.0 0 8,566

CTE Scan on get_response_choices (cost=0.00..700.00 rows=200 width=32) (actual time=0.003..0.003 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
58. 0.044 111.758 ↓ 41.0 41 1

Hash Join (cost=291.47..305.25 rows=1 width=303) (actual time=111.736..111.758 rows=41 loops=1)

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

Initplan (forHash Join)

60. 0.007 0.008 ↑ 1.0 1 1

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

61. 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.001..0.001 rows=1 loops=1)

62. 0.006 0.007 ↑ 1.0 1 1

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

63. 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)

64. 0.020 0.093 ↑ 1,000.0 1 1

HashAggregate (cost=225.00..235.00 rows=1,000 width=64) (actual time=0.089..0.093 rows=1 loops=1)

  • Group Key: COALESCE(rc_1.translated_response, rc_1.text_response)
65. 0.073 0.073 ↑ 10,000.0 1 1

CTE Scan on get_filtered_response_choices rc_1 (cost=0.00..200.00 rows=10,000 width=64) (actual time=0.072..0.073 rows=1 loops=1)

66. 0.143 111.606 ↓ 41.0 41 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
67. 4.445 111.463 ↓ 41.0 41 1

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

68. 0.958 17.618 ↓ 3,725.0 3,725 1

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

69. 0.008 0.010 ↑ 1.0 1 1

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

  • Group Key: get_event_1.event_uuid
70. 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)

71. 0.618 16.650 ↓ 3,725.0 3,725 1

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

72. 16.032 16.032 ↓ 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.056..16.032 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
73. 89.400 89.400 ↓ 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.024..0.024 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))
74.          

CTE get_teams

75. 0.809 59.526 ↓ 6.0 6 1

GroupAggregate (cost=7.14..7.17 rows=1 width=56) (actual time=58.481..59.526 rows=6 loops=1)

  • Group Key: team_ntfns.team_ntfn_uuid, team_ntfns.team_parent_ntfn_uuid
76. 2.326 58.717 ↓ 3,725.0 3,725 1

Sort (cost=7.14..7.14 rows=1 width=56) (actual time=58.461..58.717 rows=3,725 loops=1)

  • Sort Key: team_ntfns.team_ntfn_uuid, team_ntfns.team_parent_ntfn_uuid
  • Sort Method: quicksort Memory: 460kB
77. 0.621 56.391 ↓ 3,725.0 3,725 1

Subquery Scan on team_ntfns (cost=7.09..7.13 rows=1 width=56) (actual time=52.677..56.391 rows=3,725 loops=1)

78. 2.395 55.770 ↓ 3,725.0 3,725 1

GroupAggregate (cost=7.09..7.12 rows=1 width=72) (actual time=52.675..55.770 rows=3,725 loops=1)

  • Group Key: en.person_ntfn_uuid, en.team_ntfn_uuid, en.team_parent_ntfn_uuid
79. 3.370 53.375 ↓ 3,725.0 3,725 1

Sort (cost=7.09..7.09 rows=1 width=80) (actual time=52.659..53.375 rows=3,725 loops=1)

  • Sort Key: en.person_ntfn_uuid, en.team_ntfn_uuid, en.team_parent_ntfn_uuid
  • Sort Method: quicksort Memory: 620kB
80. 0.567 50.005 ↓ 3,725.0 3,725 1

Subquery Scan on en (cost=7.03..7.08 rows=1 width=80) (actual time=43.994..50.005 rows=3,725 loops=1)

81. 4.504 49.438 ↓ 3,725.0 3,725 1

GroupAggregate (cost=7.03..7.07 rows=1 width=128) (actual time=43.992..49.438 rows=3,725 loops=1)

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

Initplan (forGroupAggregate)

83. 0.007 0.008 ↑ 1.0 1 1

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

84. 0.001 0.001 ↑ 1.0 1 1

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

85. 0.004 0.007 ↑ 1.0 1 1

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

86. 0.003 0.003 ↑ 1.0 1 1

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

87. 7.501 44.919 ↓ 8,607.0 8,607 1

Sort (cost=6.96..6.97 rows=1 width=96) (actual time=43.971..44.919 rows=8,607 loops=1)

  • Sort Key: n.person_uuid, n.person_ntfn_uuid, team_ntfn.notification_uuid, team_ntfn.parent_ntfn_uuid
  • Sort Method: quicksort Memory: 1595kB
88. 8.672 37.418 ↓ 8,607.0 8,607 1

Nested Loop (cost=0.41..6.96 rows=1 width=96) (actual time=0.071..37.418 rows=8,607 loops=1)

89. 2.925 2.925 ↓ 4,303.5 8,607 1

CTE Scan on get_person_device_notifications n (cost=0.00..0.04 rows=2 width=80) (actual time=0.002..2.925 rows=8,607 loops=1)

90. 0.000 25.821 ↑ 1.0 1 8,607

Append (cost=0.41..3.45 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=8,607)

91. 25.821 25.821 ↑ 1.0 1 8,607

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) (actual time=0.003..0.003 rows=1 loops=8,607)

  • 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)))
92.          

CTE get_team_groups

93. 0.006 59.750 ↑ 1.8 6 1

Recursive Union (cost=0.50..352.23 rows=11 width=74) (actual time=59.628..59.750 rows=6 loops=1)

94. 0.000 59.699 ↓ 6.0 6 1

Nested Loop (cost=0.50..3.56 rows=1 width=74) (actual time=59.625..59.699 rows=6 loops=1)

95.          

Initplan (forNested Loop)

96. 0.007 0.008 ↑ 1.0 1 1

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

97. 0.001 0.001 ↑ 1.0 1 1

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

98. 0.015 0.018 ↑ 1.0 1 1

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

99. 0.003 0.003 ↑ 1.0 1 1

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

100. 0.013 59.549 ↓ 6.0 6 1

HashAggregate (cost=0.02..0.03 rows=1 width=16) (actual time=59.547..59.549 rows=6 loops=1)

  • Group Key: get_teams.team_ntfn_uuid
101. 59.536 59.536 ↓ 6.0 6 1

CTE Scan on get_teams (cost=0.00..0.02 rows=1 width=16) (actual time=58.486..59.536 rows=6 loops=1)

102. 0.006 0.138 ↑ 1.0 1 6

Append (cost=0.41..3.45 rows=1 width=54) (actual time=0.023..0.023 rows=1 loops=6)

103. 0.132 0.132 ↑ 1.0 1 6

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) (actual time=0.022..0.022 rows=1 loops=6)

  • 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)))
104. 0.000 0.045 ↓ 0.0 0 1

Nested Loop (cost=0.48..34.85 rows=1 width=74) (actual time=0.045..0.045 rows=0 loops=1)

105.          

Initplan (forNested Loop)

106. 0.000 0.000 ↓ 0.0 0

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

107. 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)

108. 0.005 0.006 ↑ 1.0 1 1

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

109. 0.001 0.001 ↑ 1.0 1 1

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

110. 0.004 0.004 ↑ 1.7 6 1

WorkTable Scan on get_team_groups tg_1 (cost=0.00..0.20 rows=10 width=36) (actual time=0.003..0.004 rows=6 loops=1)

111. 0.000 0.036 ↓ 0.0 0 6

Append (cost=0.41..3.45 rows=1 width=54) (actual time=0.006..0.006 rows=0 loops=6)

112. 0.036 0.036 ↓ 0.0 0 6

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) (actual time=0.006..0.006 rows=0 loops=6)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (notification_uuid = tg_1.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)))
  • Rows Removed by Filter: 1
113.          

CTE get_targeted_groups

114. 0.001 59.864 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.93..3.99 rows=1 width=168) (actual time=59.864..59.864 rows=0 loops=1)

115.          

Initplan (forNested Loop Left Join)

116. 0.000 0.000 ↓ 0.0 0

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

117. 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)

118. 0.003 59.863 ↓ 0.0 0 1

HashAggregate (cost=0.34..0.35 rows=1 width=88) (actual time=59.863..59.863 rows=0 loops=1)

  • Group Key: team_group.notification_uuid, team_group.recipient_uuid
119. 0.001 59.860 ↓ 0.0 0 1

Nested Loop (cost=0.26..0.33 rows=1 width=72) (actual time=59.860..59.860 rows=0 loops=1)

  • Join Filter: (team_group.root_uuid = team.team_ntfn_uuid)
120. 0.002 59.859 ↓ 0.0 0 1

Subquery Scan on team_group (cost=0.26..0.29 rows=1 width=48) (actual time=59.859..59.859 rows=0 loops=1)

  • Filter: (team_group.""row"" = 1)
121. 0.025 59.857 ↓ 0.0 0 1

WindowAgg (cost=0.26..0.28 rows=1 width=60) (actual time=59.857..59.857 rows=0 loops=1)

122. 0.073 59.832 ↓ 0.0 0 1

Sort (cost=0.26..0.26 rows=1 width=52) (actual time=59.832..59.832 rows=0 loops=1)

  • Sort Key: tg_2.root_uuid, tg_2.group_level DESC
  • Sort Method: quicksort Memory: 25kB
123. 59.759 59.759 ↓ 0.0 0 1

CTE Scan on get_team_groups tg_2 (cost=0.00..0.25 rows=1 width=52) (actual time=59.759..59.759 rows=0 loops=1)

  • Filter: (category = 'GROUP'::text)
  • Rows Removed by Filter: 6
124. 0.000 0.000 ↓ 0.0 0

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

125. 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))
126.          

CTE get_total_person_uuids

127. 1.122 120.479 ↓ 1,338.0 1,338 1

Hash Join (cost=272.27..286.06 rows=1 width=184) (actual time=119.489..120.479 rows=1,338 loops=1)

  • Hash Cond: (COALESCE(rc_2.translated_response, rc_2.text_response) = (resp.response)::text)
128. 0.024 0.032 ↑ 1,000.0 1 1

HashAggregate (cost=225.00..235.00 rows=1,000 width=64) (actual time=0.026..0.032 rows=1 loops=1)

  • Group Key: COALESCE(rc_2.translated_response, rc_2.text_response)
129. 0.008 0.008 ↑ 10,000.0 1 1

CTE Scan on get_filtered_response_choices rc_2 (cost=0.00..200.00 rows=10,000 width=64) (actual time=0.007..0.008 rows=1 loops=1)

130. 1.563 119.325 ↓ 1,338.0 1,338 1

Hash (cost=47.25..47.25 rows=1 width=152) (actual time=119.325..119.325 rows=1,338 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 339kB
131. 48.976 117.762 ↓ 1,338.0 1,338 1

Nested Loop (cost=44.06..47.25 rows=1 width=152) (actual time=24.163..117.762 rows=1,338 loops=1)

132. 35.165 64.130 ↓ 1,164.0 1,164 1

GroupAggregate (cost=0.05..0.20 rows=1 width=136) (actual time=24.054..64.130 rows=1,164 loops=1)

  • Group Key: en_1.person_uuid
  • Filter: (CASE WHEN ((array_agg(en_1.device_delivery_status) FILTER (WHERE (en_1.device_delivery_status IS NOT NULL)) @> '{RESPONDED}'::text[]) OR (min(en_1.person_response_received) IS NOT NULL)) THEN 'RESPONDED'::text WHEN (array_agg(en_1.device_delivery_status) FILTER (WHERE (en_1.device_delivery_status IS NOT NULL)) @> '{DELIVERED}'::text[]) THEN 'DELIVERED'::text WHEN (array_agg(en_1.device_delivery_status) FILTER (WHERE (en_1.device_delivery_status IS NOT NULL)) @> '{PENDING}'::text[]) THEN 'PENDING'::text WHEN ((array_agg(en_1.device_delivery_status) FILTER (WHERE (en_1.device_delivery_status IS NOT NULL)) @> '{FAILED}'::text[]) AND (min(en_1.person_delinked_date) IS NOT NULL)) THEN 'FAILED'::text ELSE 'PENDING'::text END = 'RESPONDED'::text)
  • Rows Removed by Filter: 2561
133. 11.571 28.965 ↓ 4,303.5 8,607 1

Sort (cost=0.05..0.06 rows=2 width=104) (actual time=23.948..28.965 rows=8,607 loops=1)

  • Sort Key: en_1.person_uuid
  • Sort Method: quicksort Memory: 1592kB
134. 17.394 17.394 ↓ 4,303.5 8,607 1

CTE Scan on get_person_device_notifications en_1 (cost=0.00..0.04 rows=2 width=104) (actual time=0.005..17.394 rows=8,607 loops=1)

135. 0.000 4.656 ↑ 1.0 1 1,164

Index Scan using responses_notification_uuid_idx on responses resp (cost=44.01..47.03 rows=1 width=32) (actual time=0.003..0.004 rows=1 loops=1,164)

  • Index Cond: (notification_uuid = (SubPlan 24))
  • 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))
136.          

SubPlan (forIndex Scan)

137. 0.000 46.560 ↑ 1.0 1 1,164

Limit (cost=43.45..43.45 rows=1 width=24) (actual time=0.040..0.040 rows=1 loops=1,164)

138. 3.492 46.560 ↑ 1.0 1 1,164

Sort (cost=43.45..43.45 rows=1 width=24) (actual time=0.040..0.040 rows=1 loops=1,164)

  • Sort Key: r.received DESC
  • Sort Method: quicksort Memory: 25kB
139. 43.068 43.068 ↑ 1.0 1 1,164

Index Scan using responses_notification_uuid_idx on responses r (cost=0.56..43.44 rows=1 width=24) (actual time=0.023..0.037 rows=1 loops=1,164)

  • Index Cond: (notification_uuid = ANY (((array_agg(DISTINCT en_1.device_ntfn_uuid) FILTER (WHERE (en_1.device_ntfn_uuid IS NOT NULL))) || (array_agg(DISTINCT en_1.person_ntfn_uuid) FILTER (WHERE (en_1.person_ntfn_uuid IS NOT NULL))))))
  • Filter: ((is_visible IS TRUE) AND (valid_range @> '2019-09-04 17:12:18+00'::timestamp with time zone) AND ((response)::text <> 'XMATTERS_REMOVE'::text) AND (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid))
140.          

CTE get_person_uuids

141. 0.006 122.772 ↓ 10.0 10 1

Limit (cost=0.03..0.04 rows=1 width=200) (actual time=122.768..122.772 rows=10 loops=1)

142. 0.554 122.766 ↓ 10.0 10 1

Sort (cost=0.03..0.04 rows=1 width=200) (actual time=122.764..122.766 rows=10 loops=1)

  • Sort Key: en_agg.last_response DESC NULLS LAST, en_agg.delivered_date_min DESC
  • Sort Method: top-N heapsort Memory: 33kB
143. 122.212 122.212 ↓ 1,338.0 1,338 1

CTE Scan on get_total_person_uuids en_agg (cost=0.00..0.02 rows=1 width=200) (actual time=119.495..122.212 rows=1,338 loops=1)

144.          

CTE get_person_and_roles

145. 0.079 87.774 ↑ 2,322.7 9 1

Nested Loop Left Join (cost=65.13..1,349,693.76 rows=20,904 width=408) (actual time=15.934..87.774 rows=9 loops=1)

146. 0.053 61.991 ↑ 2,322.7 9 1

Nested Loop (cost=0.59..9.72 rows=20,904 width=397) (actual time=12.943..61.991 rows=9 loops=1)

147. 0.044 0.048 ↓ 10.0 10 1

HashAggregate (cost=0.02..0.03 rows=1 width=16) (actual time=0.020..0.048 rows=10 loops=1)

  • Group Key: get_person_uuids_1.person_uuid
148. 0.004 0.004 ↓ 10.0 10 1

CTE Scan on get_person_uuids get_person_uuids_1 (cost=0.00..0.02 rows=1 width=16) (actual time=0.001..0.004 rows=10 loops=1)

149. 0.040 61.890 ↑ 1.0 1 10

Append (cost=0.57..9.67 rows=1 width=397) (actual time=6.117..6.189 rows=1 loops=10)

150. 61.850 61.850 ↑ 1.0 1 10

Index Scan using persons_org_part_default_organization_uuid_person_uuid_sequ_idx on persons_org_part_default p (cost=0.57..9.67 rows=1 width=397) (actual time=6.114..6.185 rows=1 loops=10)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (person_uuid = get_person_uuids_1.person_uuid))
  • Filter: ((is_visible IS TRUE) AND (valid_range @> '2019-09-04 17:12:18+00'::timestamp with time zone))
  • Rows Removed by Filter: 288
151. 0.576 25.704 ↑ 1.0 1 9

Aggregate (cost=64.54..64.55 rows=1 width=32) (actual time=2.855..2.856 rows=1 loops=9)

152. 0.279 25.128 ↑ 200.0 1 9

Hash Right Join (cost=22.31..55.53 rows=200 width=58) (actual time=2.781..2.792 rows=1 loops=9)

  • Hash Cond: (role.role_uuid = (((jsonb_array_elements_text(pr_1.roles)))::uuid))
153. 0.540 0.801 ↓ 2.9 23 9

Bitmap Heap Scan on roles role (cost=1.96..35.14 rows=8 width=58) (actual time=0.056..0.089 rows=23 loops=9)

  • Recheck Cond: (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid)
  • Filter: upper_inf(valid_range)
  • Rows Removed by Filter: 12
  • Heap Blocks: exact=54
154. 0.261 0.261 ↓ 1.5 35 9

Bitmap Index Scan on roles_organization_uuid_idx (cost=0.00..1.96 rows=23 width=0) (actual time=0.029..0.029 rows=35 loops=9)

  • Index Cond: (organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid)
155. 0.081 24.048 ↑ 200.0 1 9

Hash (cost=17.84..17.84 rows=200 width=16) (actual time=2.672..2.672 rows=1 loops=9)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
156. 0.081 23.967 ↑ 200.0 1 9

Nested Loop Left Join (cost=0.56..17.84 rows=200 width=16) (actual time=2.658..2.663 rows=1 loops=9)

157. 23.643 23.643 ↑ 2.0 1 9

Index Scan using person_roles_org_seq_vrange_uidx on person_roles pr_1 (cost=0.56..9.31 rows=2 width=34) (actual time=2.623..2.627 rows=1 loops=9)

  • Index Cond: ((organization_uuid = 'fe857c89-72ec-4b77-ab22-96bd295ece2c'::uuid) AND (person_uuid = p.person_uuid))
  • Filter: upper_inf(valid_range)
  • Rows Removed by Filter: 142
158. 0.054 0.243 ↑ 100.0 1 9

Result (cost=0.00..2.27 rows=100 width=16) (actual time=0.026..0.027 rows=1 loops=9)

159. 0.189 0.189 ↑ 100.0 1 9

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.020..0.021 rows=1 loops=9)

160. 0.000 0.000 ↑ 1.0 1 9

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

161.          

CTE get_person_notifications

162. 0.013 837.377 ↓ 5.0 10 1

Subquery Scan on p_1 (cost=185.41..280.56 rows=2 width=304) (actual time=835.984..837.377 rows=10 loops=1)

163. 1.860 837.364 ↓ 5.0 10 1

GroupAggregate (cost=185.41..280.51 rows=2 width=272) (actual time=835.977..837.364 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
164. 0.171 835.504 ↑ 64.7 28 1

Sort (cost=185.41..189.93 rows=1,811 width=326) (actual time=835.498..835.504 rows=28 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
165. 0.081 835.333 ↑ 64.7 28 1

Nested Loop Left Join (cost=0.59..87.41 rows=1,811 width=326) (actual time=797.062..835.333 rows=28 loops=1)

166. 1.372 797.816 ↓ 28.0 28 1

Hash Semi Join (cost=0.03..0.09 rows=1 width=280) (actual time=795.478..797.816 rows=28 loops=1)

  • Hash Cond: (get_person_device_notifications.person_uuid = get_person_uuids_2.person_uuid)
167. 673.637 673.637 ↓ 4,303.5 8,607 1

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

168. 0.021 122.807 ↓ 10.0 10 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
169. 122.786 122.786 ↓ 10.0 10 1

CTE Scan on get_person_uuids get_person_uuids_2 (cost=0.00..0.02 rows=1 width=16) (actual time=122.772..122.786 rows=10 loops=1)

170. 0.056 37.436 ↑ 1.0 1 28

Append (cost=0.56..87.31 rows=1 width=62) (actual time=0.678..1.337 rows=1 loops=28)

171. 37.380 37.380 ↑ 1.0 1 28

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=0.677..1.335 rows=1 loops=28)

  • Index Cond: (recipient_uuid = get_person_device_notifications.device_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))
  • Rows Removed by Filter: 139
172.          

Initplan (forSort)

173. 0.100 0.359 ↑ 1.0 1 1

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

174. 0.259 0.259 ↓ 1,338.0 1,338 1

CTE Scan on get_total_person_uuids (cost=0.00..0.02 rows=1 width=0) (actual time=0.002..0.259 rows=1,338 loops=1)

175. 0.003 0.003 ↑ 1.0 1 1

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

176. 0.527 988.625 ↑ 20.9 10 1

Hash Right Join (cost=1,416.75..1,918.44 rows=209 width=256) (actual time=916.659..988.625 rows=10 loops=1)

  • Hash Cond: (get_person_and_roles.person_uuid = pn.person_uuid)
177. 87.817 87.817 ↑ 2,322.7 9 1

CTE Scan on get_person_and_roles (cost=0.00..418.08 rows=20,904 width=16) (actual time=15.940..87.817 rows=9 loops=1)

178. 0.045 900.281 ↓ 5.0 10 1

Hash (cost=1,416.72..1,416.72 rows=2 width=264) (actual time=900.281..900.281 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
179. 0.025 900.236 ↓ 5.0 10 1

Merge Left Join (cost=354.40..1,416.72 rows=2 width=264) (actual time=897.882..900.236 rows=10 loops=1)

  • Merge Cond: (pn.person_uuid = get_person_uuids.person_uuid)
180. 0.016 900.160 ↓ 5.0 10 1

Nested Loop Left Join (cost=354.37..1,416.67 rows=2 width=232) (actual time=897.823..900.160 rows=10 loops=1)

181. 0.023 840.264 ↓ 5.0 10 1

Nested Loop Left Join (cost=354.34..1,416.55 rows=2 width=232) (actual time=837.945..840.264 rows=10 loops=1)

182. 0.023 840.101 ↓ 5.0 10 1

Nested Loop Left Join (cost=176.57..1,060.95 rows=2 width=232) (actual time=837.916..840.101 rows=10 loops=1)

183. 1.303 838.868 ↓ 5.0 10 1

GroupAggregate (cost=0.05..707.83 rows=2 width=248) (actual time=837.753..838.868 rows=10 loops=1)

  • Group Key: pn.person_uuid, pn.event_uuid
184. 0.111 837.565 ↓ 5.0 10 1

Sort (cost=0.05..0.06 rows=2 width=288) (actual time=837.559..837.565 rows=10 loops=1)

  • Sort Key: pn.person_uuid, pn.event_uuid
  • Sort Method: quicksort Memory: 44kB
185. 837.454 837.454 ↓ 5.0 10 1

CTE Scan on get_person_notifications pn (cost=0.00..0.04 rows=2 width=288) (actual time=835.998..837.454 rows=10 loops=1)

186.          

SubPlan (forGroupAggregate)

187. 0.000 0.000 ↓ 0.0 0

Unique (cost=353.32..353.82 rows=79 width=32) (never executed)

188. 0.000 0.000 ↓ 0.0 0

Sort (cost=353.32..353.57 rows=100 width=32) (never executed)

  • Sort Key: get_filtered_response_choices.text_response
189. 0.000 0.000 ↓ 0.0 0

CTE Scan on get_filtered_response_choices (cost=0.00..350.00 rows=100 width=32) (never executed)

  • Filter: ((lower((pn.person_response_value)::text) = lower(text_response)) OR (lower((pn.person_response_value)::text) = lower(translated_response)))
190. 1.080 1.210 ↑ 1.0 1 10

Aggregate (cost=176.52..176.53 rows=1 width=32) (actual time=0.121..0.121 rows=1 loops=10)

191. 0.050 0.130 ↑ 3,333.3 3 10

ProjectSet (cost=0.00..51.52 rows=10,000 width=32) (actual time=0.012..0.013 rows=3 loops=10)

192. 0.080 0.080 ↑ 100.0 1 10

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.007..0.008 rows=1 loops=10)

193. 0.000 0.000 ↑ 1.0 1 10

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

194. 0.090 0.140 ↑ 1.0 1 10

Aggregate (cost=177.77..177.78 rows=1 width=32) (actual time=0.014..0.014 rows=1 loops=10)

195. 0.030 0.050 ↑ 10,000.0 1 10

ProjectSet (cost=0.00..52.77 rows=10,000 width=32) (actual time=0.005..0.005 rows=1 loops=10)

196. 0.020 0.020 ↑ 100.0 1 10

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

197. 0.000 0.000 ↑ 1.0 1 10

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

198. 0.010 59.880 ↑ 1.0 1 10

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=5.988..5.988 rows=1 loops=10)

199. 59.870 59.870 ↓ 0.0 0 10

CTE Scan on get_targeted_groups tg (cost=0.00..0.02 rows=1 width=120) (actual time=5.987..5.987 rows=0 loops=10)

  • Filter: (team_ntfn_uuids && (array_agg(pn.team_uuid)))
200. 0.043 0.051 ↓ 10.0 10 1

Sort (cost=0.03..0.04 rows=1 width=48) (actual time=0.049..0.051 rows=10 loops=1)

  • Sort Key: get_person_uuids.person_uuid
  • Sort Method: quicksort Memory: 25kB
201. 0.008 0.008 ↓ 10.0 10 1

CTE Scan on get_person_uuids (cost=0.00..0.02 rows=1 width=48) (actual time=0.004..0.008 rows=10 loops=1)

Planning time : 4,466.126 ms
Execution time : 1,006.143 ms