explain.depesz.com

PostgreSQL's explain analyze made readable

Result: g2MT

Settings
# exclusive inclusive rows x rows loops node
1. 62.893 111,989.476 ↓ 1,842.0 1,842 1

GroupAggregate (cost=856,158.08..856,159.63 rows=1 width=650) (actual time=111,926.382..111,989.476 rows=1,842 loops=1)

  • Group Key: chwlist.branch_uuid, chwlist.branch_name, chwlist.supervisor_uuid, chwlist.supervisor_name, chwlist.chw_uuid, chwlist.chw_name, chwlist.chw_phone, (date(chwlist.interval_start)), chwlist.interval_number
  • Functions: 915
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 135.851 ms, Inlining 54.196 ms, Optimization 9276.128 ms, Emission 6673.700 ms, Total 16139.876 ms
2. 14.772 111,926.583 ↓ 921.0 1,842 1

Sort (cost=856,158.08..856,158.08 rows=2 width=1,986) (actual time=111,926.289..111,926.583 rows=1,842 loops=1)

  • Sort Key: chwlist.branch_uuid, chwlist.branch_name, chwlist.supervisor_uuid, chwlist.supervisor_name, chwlist.chw_uuid, chwlist.chw_name, chwlist.chw_phone, (date(chwlist.interval_start)), chwlist.interval_number
  • Sort Method: quicksort Memory: 1648kB
3. 6.392 111,911.811 ↓ 921.0 1,842 1

Merge Left Join (cost=846,132.58..856,158.07 rows=2 width=1,986) (actual time=21,557.672..111,911.811 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1_2".reported_by)
  • Join Filter: (chwlist.interval_number = (0))
4. 5.856 111,892.110 ↓ 921.0 1,842 1

Merge Left Join (cost=843,996.25..853,307.20 rows=2 width=1,934) (actual time=21,546.182..111,892.110 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = useview_home_visit.reported_by)
  • Join Filter: (chwlist.interval_number = (0))
5. 3.220 111,361.359 ↓ 921.0 1,842 1

Merge Left Join (cost=804,194.22..811,986.53 rows=2 width=1,926) (actual time=21,207.609..111,361.359 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1_1".chw_uuid)
  • Join Filter: (chwlist.interval_number = (0))
6. 4.473 111,257.355 ↓ 921.0 1,842 1

Merge Left Join (cost=796,013.63..803,805.83 rows=2 width=1,918) (actual time=21,106.818..111,257.355 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = dr.chw)
  • Join Filter: (chwlist.interval_number = (0))
7. 6.712 111,238.270 ↓ 921.0 1,842 1

Merge Left Join (cost=795,762.54..803,551.24 rows=2 width=1,902) (actual time=21,095.774..111,238.270 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess_u1fu_pnc_aggregated.chw)
  • Join Filter: (chwlist.interval_number = (0))
8. 6.328 110,879.401 ↓ 921.0 1,842 1

Merge Left Join (cost=777,972.85..785,741.02 rows=2 width=1,862) (actual time=20,831.824..110,879.401 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1".reported_by)
  • Join Filter: (chwlist.interval_number = (0))
9. 197.146 110,726.681 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=773,723.10..781,377.54 rows=2 width=1,846) (actual time=20,706.190..110,726.681 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_area_uuid = population_all_time.chw_area_uuid) AND (chwlist.interval_number = population_all_time.interval_number))
  • Rows Removed by Join Filter: 2043592
10. 241.068 110,011.933 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=713,184.59..720,713.62 rows=2 width=1,874) (actual time=20,323.145..110,011.933 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = sync.chw_uuid) AND (chwlist.interval_number = sync.interval_number))
  • Rows Removed by Join Filter: 2495082
11. 190.492 107,615.725 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=543,964.16..551,338.28 rows=2 width=1,866) (actual time=18,330.978..107,615.725 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_area_uuid = contactview_metadata_1.parent_uuid) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 2066260
12. 7.417 106,277.667 ↓ 1,842.0 1,842 1

Merge Left Join (cost=532,601.48..537,170.73 rows=1 width=1,822) (actual time=18,191.167..106,277.667 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = survey.chw)
  • Join Filter: (chwlist.interval_number = (0))
13. 205.413 106,212.565 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=524,114.99..528,325.46 rows=1 width=1,798) (actual time=18,167.618..106,212.565 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_area_uuid = population.chp_area_uuid) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 2292077
14. 330.077 104,925.898 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=515,666.32..519,784.95 rows=1 width=1,686) (actual time=18,141.659..104,925.898 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = useview_households_visited.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 3039541
15. 16.281 22,849.703 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=480,921.17..484,347.63 rows=1 width=1,678) (actual time=18,061.732..22,849.703 rows=1,842 loops=1)

  • Join Filter: (chwlist.interval_number = 0)
16. 84.758 20,394.614 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=480,920.89..481,335.93 rows=1 width=1,674) (actual time=18,060.972..20,394.614 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = meta.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 930914
17. 6.329 20,035.398 ↓ 1,842.0 1,842 1

Merge Left Join (cost=476,727.46..477,080.94 rows=1 width=1,666) (actual time=18,008.776..20,035.398 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess.chw)
  • Join Filter: (chwlist.interval_number = (0))
18. 54.950 19,953.198 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=458,052.77..458,366.83 rows=1 width=1,658) (actual time=17,938.449..19,953.198 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = p.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 597072
19. 112.396 19,340.122 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=424,042.54..424,349.60 rows=1 width=1,650) (actual time=17,501.404..19,340.122 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = pnc_1.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 1276243
20. 109.823 18,682.494 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=422,237.83..422,498.93 rows=1 width=1,554) (actual time=17,492.611..18,682.494 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = useview_pregnancy.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 1229722
21. 73.667 18,266.899 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=421,841.59..422,065.17 rows=1 width=1,538) (actual time=17,490.654..18,266.899 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_area_uuid = contactview_metadata.parent_uuid) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 789071
22. 8.418 17,261.180 ↓ 1,842.0 1,842 1

Merge Left Join (cost=404,249.88..404,420.19 rows=1 width=1,530) (actual time=17,247.425..17,261.180 rows=1,842 loops=1)

  • Merge Cond: ((chwlist.chw_uuid = anc_pnc_u1fu.chw_uuid) AND (chwlist.interval_number = anc_pnc_u1fu.interval_number))
23. 5.903 16,132.188 ↓ 1,842.0 1,842 1

Sort (cost=32,500.31..32,500.32 rows=1 width=1,482) (actual time=16,130.869..16,132.188 rows=1,842 loops=1)

  • Sort Key: chwlist.chw_uuid, chwlist.interval_number
  • Sort Method: quicksort Memory: 938kB
24. 0.970 16,126.285 ↓ 1,842.0 1,842 1

Hash Right Join (cost=32,205.59..32,500.30 rows=1 width=1,482) (actual time=16,120.405..16,126.285 rows=1,842 loops=1)

  • Hash Cond: ((chwview_assessment.chw_uuid = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
25. 26.560 45.759 ↑ 1.3 1,624 1

HashAggregate (cost=23,967.51..24,204.32 rows=2,105 width=1,292) (actual time=40.835..45.759 rows=1,624 loops=1)

  • Group Key: chwview_assessment.chw_uuid, 0
26. 12.558 19.199 ↑ 1.1 33,495 1

Bitmap Heap Scan on chwview_assessment (cost=682.66..20,258.07 rows=35,328 width=352) (actual time=6.951..19.199 rows=33,495 loops=1)

  • Recheck Cond: ((reported_day >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported_day < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Heap Blocks: exact=2182
27. 6.641 6.641 ↑ 1.1 33,495 1

Bitmap Index Scan on chwview_assessment_reported_chw_uuid (cost=0.00..673.83 rows=35,328 width=0) (actual time=6.641..6.641 rows=33,495 loops=1)

  • Index Cond: ((reported_day >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported_day < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
28. 0.883 16,079.556 ↓ 1,842.0 1,842 1

Hash (cost=8,238.07..8,238.07 rows=1 width=230) (actual time=16,079.556..16,079.556 rows=1,842 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 492kB
29. 0.740 16,078.673 ↓ 1,842.0 1,842 1

Hash Right Join (cost=8,185.15..8,238.07 rows=1 width=230) (actual time=16,077.624..16,078.673 rows=1,842 loops=1)

  • Hash Cond: ((anc.chw = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
30. 1.814 22.760 ↑ 1.4 1,341 1

HashAggregate (cost=7,983.42..8,002.66 rows=1,924 width=48) (actual time=22.440..22.760 rows=1,341 loops=1)

  • Group Key: anc.chw, 0
31. 1.125 20.946 ↓ 1.0 5,256 1

Bitmap Heap Scan on useview_pregnancy_visit anc (cost=4,341.75..7,944.26 rows=5,221 width=40) (actual time=19.852..20.946 rows=5,256 loops=1)

  • Recheck Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Heap Blocks: exact=155
32. 19.821 19.821 ↓ 1.0 5,256 1

Bitmap Index Scan on useview_pregnancy_visit_pregnancy_reported_uuid (cost=0.00..4,340.45 rows=5,221 width=0) (actual time=19.821..19.821 rows=5,256 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
33. 0.895 16,055.173 ↓ 1,842.0 1,842 1

Hash (cost=201.72..201.72 rows=1 width=222) (actual time=16,055.173..16,055.173 rows=1,842 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 469kB
34. 0.266 16,054.278 ↓ 1,842.0 1,842 1

Subquery Scan on chwlist (cost=191.48..201.72 rows=1 width=222) (actual time=16,045.979..16,054.278 rows=1,842 loops=1)

35. 0.000 16,054.012 ↓ 1,842.0 1,842 1

Nested Loop Anti Join (cost=191.48..201.71 rows=1 width=222) (actual time=16,045.977..16,054.012 rows=1,842 loops=1)

36. 1.052 16,047.219 ↓ 469.2 2,346 1

Group (cost=191.21..191.34 rows=5 width=222) (actual time=16,045.944..16,047.219 rows=2,346 loops=1)

  • Group Key: cmd.uuid, cmd.name, chp_1.supervisor_uuid, chp_1.area_uuid, cmeta.name, chp_1.uuid, chp_1.name, chp_1.phone, (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval))), (0)
37. 8.342 16,046.167 ↓ 469.2 2,346 1

Sort (cost=191.21..191.22 rows=5 width=222) (actual time=16,045.915..16,046.167 rows=2,346 loops=1)

  • Sort Key: cmd.uuid, cmd.name, chp_1.supervisor_uuid, chp_1.area_uuid, cmeta.name, chp_1.uuid, chp_1.name, chp_1.phone, (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval))), (0)
  • Sort Method: quicksort Memory: 720kB
38. 0.395 16,037.825 ↓ 469.2 2,346 1

Hash Join (cost=149.85..191.15 rows=5 width=222) (actual time=16,037.455..16,037.825 rows=2,346 loops=1)

  • Hash Cond: ((row_number() OVER (?)) = (row_number() OVER (?)))
39. 0.011 16,015.615 ↑ 1,000.0 1 1

WindowAgg (cost=59.85..87.35 rows=1,000 width=24) (actual time=16,015.614..16,015.615 rows=1 loops=1)

40. 0.008 16,015.604 ↑ 1,000.0 1 1

Sort (cost=59.85..62.35 rows=1,000 width=8) (actual time=16,015.604..16,015.604 rows=1 loops=1)

  • Sort Key: generate_series.generate_series
  • Sort Method: quicksort Memory: 25kB
41. 16,015.596 16,015.596 ↑ 1,000.0 1 1

Function Scan on generate_series (cost=0.02..10.02 rows=1,000 width=8) (actual time=16,015.596..16,015.596 rows=1 loops=1)

42. 1.170 21.815 ↓ 2,346.0 2,346 1

Hash (cost=89.99..89.99 rows=1 width=222) (actual time=21.815..21.815 rows=2,346 loops=1)

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 608kB
43. 2.007 20.645 ↓ 2,346.0 2,346 1

Nested Loop (cost=4.76..89.99 rows=1 width=222) (actual time=0.139..20.645 rows=2,346 loops=1)

44. 2.403 16.292 ↓ 2,346.0 2,346 1

Nested Loop (cost=4.69..89.87 rows=1 width=210) (actual time=0.112..16.292 rows=2,346 loops=1)

45. 0.604 2.159 ↓ 2,346.0 2,346 1

Nested Loop (cost=4.26..87.42 rows=1 width=193) (actual time=0.091..2.159 rows=2,346 loops=1)

46. 0.047 0.047 ↓ 13.0 13 1

Index Scan using contactview_metadata_type on contactview_metadata cmd (cost=0.43..2.65 rows=1 width=54) (actual time=0.040..0.047 rows=13 loops=1)

  • Index Cond: (type = 'district_hospital'::text)
  • Filter: (name <> 'HQ'::text)
  • Rows Removed by Filter: 1
47. 1.248 1.508 ↓ 1.0 180 13

Bitmap Heap Scan on contactview_chp chp_1 (cost=3.84..83.02 rows=175 width=172) (actual time=0.029..0.116 rows=180 loops=13)

  • Recheck Cond: (branch_uuid = cmd.uuid)
  • Heap Blocks: exact=883
48. 0.260 0.260 ↓ 1.0 180 13

Bitmap Index Scan on contactview_chp_branch_uuid (cost=0.00..3.79 rows=175 width=0) (actual time=0.020..0.020 rows=180 loops=13)

  • Index Cond: (branch_uuid = cmd.uuid)
49. 11.730 11.730 ↑ 1.0 1 2,346

Index Scan using contactview_metadata_uuid on contactview_metadata cmeta (cost=0.43..2.45 rows=1 width=54) (actual time=0.005..0.005 rows=1 loops=2,346)

  • Index Cond: (uuid = chp_1.supervisor_uuid)
50. 2.346 2.346 ↑ 1.0 1 2,346

WindowAgg (cost=0.07..0.09 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=2,346)

51. 0.000 0.000 ↑ 1.0 1 2,346

Sort (cost=0.07..0.08 rows=1 width=4) (actual time=0.000..0.000 rows=1 loops=2,346)

  • Sort Key: generate_series_1.generate_series
  • Sort Method: quicksort Memory: 25kB
52. 0.015 0.015 ↑ 1.0 1 1

Function Scan on generate_series generate_series_1 (cost=0.05..0.06 rows=1 width=4) (actual time=0.015..0.015 rows=1 loops=1)

53. 7.038 7.038 ↓ 0.0 0 2,346

Index Only Scan using chp_muting_chw on chp_muting (cost=0.28..2.05 rows=1 width=37) (actual time=0.003..0.003 rows=0 loops=2,346)

  • Index Cond: (chw = chp_1.uuid)
  • Heap Fetches: 504
54. 3.460 1,120.574 ↓ 1.4 680 1

GroupAggregate (cost=371,749.56..371,912.61 rows=483 width=88) (actual time=1,116.519..1,120.574 rows=680 loops=1)

  • Group Key: anc_pnc_u1fu.chw_uuid, anc_pnc_u1fu.interval_number
55.          

CTE u1s

56. 1.635 8.009 ↓ 1.1 2,230 1

HashAggregate (cost=6,393.30..6,413.21 rows=1,991 width=82) (actual time=7.615..8.009 rows=2,230 loops=1)

  • Group Key: useview_population_demographics.family_uuid, useview_population_demographics.uuid, useview_population_demographics.date_of_birth, 0
57. 6.374 6.374 ↓ 1.1 2,230 1

Index Scan using useview_population_demographics_reported_idx on useview_population_demographics (cost=0.45..6,373.39 rows=1,991 width=82) (actual time=0.056..6.374 rows=2,230 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Filter: ((date_part('years'::text, age(now(), (date_of_birth)::timestamp with time zone)))::integer <= 1)
  • Rows Removed by Filter: 2901
58. 1.004 1,117.114 ↑ 4.7 1,029 1

Sort (cost=365,336.35..365,348.43 rows=4,831 width=64) (actual time=1,116.500..1,117.114 rows=1,029 loops=1)

  • Sort Key: anc_pnc_u1fu.chw_uuid, anc_pnc_u1fu.interval_number
  • Sort Method: quicksort Memory: 193kB
59. 0.153 1,116.110 ↑ 4.7 1,029 1

Subquery Scan on anc_pnc_u1fu (cost=341,723.25..365,040.74 rows=4,831 width=64) (actual time=1,104.465..1,116.110 rows=1,029 loops=1)

60. 10.859 1,115.957 ↑ 4.7 1,029 1

GroupAggregate (cost=341,723.25..364,992.43 rows=4,831 width=100) (actual time=1,104.463..1,115.957 rows=1,029 loops=1)

  • Group Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
61. 11.778 1,105.098 ↑ 151.2 8,776 1

Sort (cost=341,723.25..345,040.52 rows=1,326,907 width=183) (actual time=1,104.401..1,105.098 rows=8,776 loops=1)

  • Sort Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
  • Sort Method: quicksort Memory: 2716kB
62. 2.260 1,093.320 ↑ 151.2 8,776 1

Hash Left Join (cost=87,670.39..137,712.67 rows=1,326,907 width=183) (actual time=959.634..1,093.320 rows=8,776 loops=1)

  • Hash Cond: (pmb.baby_uuid = u1fu.patient_id)
63. 2.922 1,082.635 ↑ 62.2 8,776 1

Hash Left Join (cost=86,450.92..117,086.99 rows=545,523 width=146) (actual time=951.163..1,082.635 rows=8,776 loops=1)

  • Hash Cond: (pmb.mother_uuid = pv.patient_id)
64. 33.560 996.586 ↑ 54.9 2,171 1

Merge Right Join (cost=77,848.72..89,477.05 rows=119,143 width=145) (actual time=867.859..996.586 rows=2,171 loops=1)

  • Merge Cond: (pc.patient_id = pmb.mother_uuid)
65. 95.189 95.189 ↑ 1.0 135,691 1

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pc (cost=0.42..9,502.20 rows=135,760 width=73) (actual time=0.017..95.189 rows=135,691 loops=1)

66. 1.770 867.837 ↑ 22.3 2,171 1

Sort (cost=77,848.30..77,969.08 rows=48,312 width=108) (actual time=867.505..867.837 rows=2,171 loops=1)

  • Sort Key: pmb.mother_uuid
  • Sort Method: quicksort Memory: 322kB
67. 0.129 866.067 ↑ 47.0 1,029 1

Subquery Scan on pmb (cost=73,123.36..74,089.60 rows=48,312 width=108) (actual time=865.403..866.067 rows=1,029 loops=1)

68. 2.236 865.938 ↑ 47.0 1,029 1

HashAggregate (cost=73,123.36..73,606.48 rows=48,312 width=176) (actual time=865.401..865.938 rows=1,029 loops=1)

  • Group Key: pnc.chw, u1s.family_uuid, (string_agg(DISTINCT pd.uuid, ','::text)), pnc.patient_id, u1s.uuid, u1s.interval_number
69. 1.640 863.702 ↑ 22.3 2,171 1

Merge Join (cost=66,362.42..72,398.68 rows=48,312 width=172) (actual time=840.556..863.702 rows=2,171 loops=1)

  • Merge Cond: (u1s.family_uuid = pd.family_uuid)
70. 3.354 12.073 ↓ 1.1 2,230 1

Sort (cost=148.92..153.90 rows=1,991 width=68) (actual time=11.722..12.073 rows=2,230 loops=1)

  • Sort Key: u1s.family_uuid
  • Sort Method: quicksort Memory: 410kB
71. 8.719 8.719 ↓ 1.1 2,230 1

CTE Scan on u1s (cost=0.00..39.82 rows=1,991 width=68) (actual time=7.619..8.719 rows=2,230 loops=1)

72. 0.914 849.989 ↑ 2.2 2,171 1

Materialize (cost=66,213.50..71,527.26 rows=4,853 width=141) (actual time=828.811..849.989 rows=2,171 loops=1)

73. 1.362 849.075 ↑ 2.5 1,978 1

Nested Loop (cost=66,213.50..71,515.13 rows=4,853 width=141) (actual time=828.808..849.075 rows=1,978 loops=1)

74. 6.758 835.893 ↓ 1.0 1,970 1

GroupAggregate (cost=66,213.08..66,252.44 rows=1,968 width=69) (actual time=828.781..835.893 rows=1,970 loops=1)

  • Group Key: pd.family_uuid
75. 4.662 829.135 ↓ 1.8 3,467 1

Sort (cost=66,213.08..66,218.00 rows=1,968 width=74) (actual time=828.758..829.135 rows=3,467 loops=1)

  • Sort Key: pd.family_uuid
  • Sort Method: quicksort Memory: 584kB
76. 1.836 824.473 ↓ 1.8 3,467 1

Hash Join (cost=66,028.48..66,105.40 rows=1,968 width=74) (actual time=822.497..824.473 rows=3,467 loops=1)

  • Hash Cond: (u1s_1.family_uuid = pd.family_uuid)
77. 0.309 0.309 ↓ 1.1 2,230 1

CTE Scan on u1s u1s_1 (cost=0.00..39.82 rows=1,991 width=32) (actual time=0.001..0.309 rows=2,230 loops=1)

78. 119.534 822.328 ↓ 1.8 314,069 1

Hash (cost=63,815.50..63,815.50 rows=177,039 width=74) (actual time=822.328..822.328 rows=314,069 loops=1)

  • Buckets: 524288 (originally 262144) Batches: 1 (originally 1) Memory Usage: 36608kB
79. 702.794 702.794 ↓ 1.8 314,069 1

Index Scan using useview_population_demographics_sex_date_of_birth_idx on useview_population_demographics pd (cost=0.42..63,815.50 rows=177,039 width=74) (actual time=0.024..702.794 rows=314,069 loops=1)

  • Index Cond: (sex = 'female'::text)
  • Filter: ((date_part('years'::text, age(now(), (date_of_birth)::timestamp with time zone)))::integer >= 15)
  • Rows Removed by Filter: 219654
80. 11.820 11.820 ↑ 2.0 1 1,970

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pnc (cost=0.42..2.64 rows=2 width=72) (actual time=0.006..0.006 rows=1 loops=1,970)

  • Index Cond: (patient_id = (string_agg(DISTINCT pd.uuid, ','::text)))
81. 47.428 83.127 ↓ 1.0 177,936 1

Hash (cost=6,378.20..6,378.20 rows=177,920 width=73) (actual time=83.127..83.127 rows=177,936 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 20464kB
82. 35.699 35.699 ↓ 1.0 177,936 1

Seq Scan on useview_pregnancy_visit pv (cost=0.00..6,378.20 rows=177,920 width=73) (actual time=0.011..35.699 rows=177,936 loops=1)

83. 4.499 8.425 ↑ 1.0 17,710 1

Hash (cost=998.10..998.10 rows=17,710 width=74) (actual time=8.425..8.425 rows=17,710 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 2090kB
84. 3.926 3.926 ↑ 1.0 17,710 1

Seq Scan on useview_u1_follow_up u1fu (cost=0.00..998.10 rows=17,710 width=74) (actual time=0.016..3.926 rows=17,710 loops=1)

85. 515.760 932.052 ↑ 2.8 429 1,842

GroupAggregate (cost=17,591.72..17,615.44 rows=1,182 width=48) (actual time=0.136..0.506 rows=429 loops=1,842)

  • Group Key: contactview_metadata.parent_uuid, 0
86. 174.170 416.292 ↑ 1.6 743 1,842

Sort (cost=17,591.72..17,594.69 rows=1,190 width=77) (actual time=0.133..0.226 rows=743 loops=1,842)

  • Sort Key: contactview_metadata.parent_uuid
  • Sort Method: quicksort Memory: 144kB
87. 242.122 242.122 ↑ 1.4 852 1

Index Scan using contactview_metadata_type on contactview_metadata (cost=0.43..17,530.93 rows=1,190 width=77) (actual time=0.171..242.122 rows=852 loops=1)

  • Index Cond: (type = 'clinic'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 238660
88. 304.697 305.772 ↑ 1.6 668 1,842

HashAggregate (cost=396.23..406.95 rows=1,072 width=56) (actual time=0.002..0.166 rows=668 loops=1,842)

  • Group Key: useview_pregnancy.chw, 0
89. 1.075 1.075 ↑ 1.0 1,398 1

Index Scan using useview_pregnancy_reported on useview_pregnancy (cost=0.32..366.89 rows=1,467 width=79) (actual time=0.026..1.075 rows=1,398 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
90. 540.553 545.232 ↑ 1.9 693 1,842

HashAggregate (cost=1,804.72..1,817.85 rows=1,313 width=136) (actual time=0.006..0.296 rows=693 loops=1,842)

  • Group Key: pnc_1.chw, 0
91. 4.679 4.679 ↑ 1.4 1,482 1

Index Scan using useview_postnatal_reported on useview_postnatal_care pnc_1 (cost=0.45..1,559.96 rows=2,083 width=102) (actual time=0.069..4.679 rows=1,482 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Filter: (follow_up_count = '1'::text)
  • Rows Removed by Filter: 4315
92. 121.373 558.126 ↓ 1.6 324 1,842

HashAggregate (cost=34,010.23..34,012.23 rows=200 width=48) (actual time=0.238..0.303 rows=324 loops=1,842)

  • Group Key: p.chw, 0
93. 0.390 436.753 ↑ 216.6 434 1

Hash Left Join (cost=32,679.51..33,305.12 rows=94,014 width=76) (actual time=421.438..436.753 rows=434 loops=1)

  • Hash Cond: (p.patient_id = useview_postnatal_care.patient_id)
  • Filter: (((max(useview_postnatal_care.reported)) IS NULL) OR ((@ ((CASE WHEN (max(pv_1.new_edd) <> ''::text) THEN (max(pv_1.new_edd))::date ELSE max(p.edd) END) - ((max(useview_postnatal_care.reported)))::date)) > 60))
  • Rows Removed by Filter: 317
94. 20.109 359.872 ↑ 2.0 751 1

HashAggregate (cost=24,330.38..24,936.57 rows=1,525 width=76) (actual time=344.890..359.872 rows=751 loops=1)

  • Group Key: p.chw, p.patient_id
  • Filter: ((max(p.edd) >= date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval))) AND CASE WHEN (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) = date_trunc('day'::text, now())) THEN (max(p.edd) <= ((date_trunc('month'::text, now()) - '1 day'::interval) - '3 days'::interval)) ELSE (max(p.edd) <= ((date_trunc('month'::text, now()) - '1 day'::interval) + '1 day'::interval)) END)
  • Rows Removed by Filter: 9750
95. 4.966 339.763 ↓ 1.3 11,506 1

Hash Anti Join (cost=20,996.74..24,147.38 rows=9,150 width=78) (actual time=308.731..339.763 rows=11,506 loops=1)

  • Hash Cond: (p.patient_id = upv.patient_id)
96. 18.384 286.663 ↓ 1.6 18,563 1

Hash Join (cost=15,927.82..18,954.64 rows=11,364 width=78) (actual time=260.577..286.663 rows=18,563 loops=1)

  • Hash Cond: (p.patient_id = pv_1.patient_id)
  • Join Filter: (p.reported < pv_1.reported)
  • Rows Removed by Join Filter: 47
97. 7.750 7.750 ↓ 1.0 60,660 1

Seq Scan on useview_pregnancy p (cost=0.00..2,867.59 rows=60,659 width=84) (actual time=0.008..7.750 rows=60,660 loops=1)

98. 4.068 260.529 ↑ 1.8 16,977 1

Hash (cost=15,539.13..15,539.13 rows=31,095 width=46) (actual time=260.529..260.529 rows=16,977 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1613kB
99. 2.287 256.461 ↑ 1.8 16,977 1

Subquery Scan on pv_1 (cost=14,964.39..15,539.13 rows=31,095 width=46) (actual time=240.264..256.461 rows=16,977 loops=1)

100. 6.874 254.174 ↑ 1.8 16,977 1

Unique (cost=14,964.39..15,228.18 rows=31,095 width=47) (actual time=240.251..254.174 rows=16,977 loops=1)

101. 125.247 247.300 ↑ 1.1 48,688 1

Sort (cost=14,964.39..15,096.28 rows=52,759 width=47) (actual time=240.250..247.300 rows=48,688 loops=1)

  • Sort Key: useview_pregnancy_visit.patient_id, useview_pregnancy_visit.reported DESC
  • Sort Method: quicksort Memory: 8342kB
102. 122.053 122.053 ↑ 1.1 48,688 1

Seq Scan on useview_pregnancy_visit (cost=0.00..10,826.20 rows=52,759 width=47) (actual time=45.068..122.053 rows=48,688 loops=1)

  • Filter: (((edd_updated IS TRUE) AND (reported > ((date_trunc('month'::text, now()) - '1 mon'::interval) - '9 mons'::interval))) OR (reported > ((date_trunc('month'::text, now()) - '1 day'::interval) - '9 mons'::interval)))
  • Rows Removed by Filter: 129248
103. 1.476 48.134 ↑ 1.6 6,783 1

Hash (cost=4,934.17..4,934.17 rows=10,780 width=36) (actual time=48.134..48.134 rows=6,783 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 586kB
104. 0.825 46.658 ↑ 1.6 6,783 1

Subquery Scan on upv (cost=4,765.42..4,934.17 rows=10,780 width=36) (actual time=43.709..46.658 rows=6,783 loops=1)

105. 1.496 45.833 ↑ 1.6 6,783 1

Unique (cost=4,765.42..4,826.37 rows=10,780 width=44) (actual time=43.701..45.833 rows=6,783 loops=1)

106. 16.814 44.337 ↑ 1.5 8,347 1

Sort (cost=4,765.42..4,795.90 rows=12,189 width=44) (actual time=43.700..44.337 rows=8,347 loops=1)

  • Sort Key: useview_pregnancy_visit_1.patient_id, useview_pregnancy_visit_1.reported DESC
  • Sort Method: quicksort Memory: 1036kB
107. 27.523 27.523 ↑ 1.5 8,347 1

Index Scan using useview_pregnancy_visit_continue_follow_up on useview_pregnancy_visit useview_pregnancy_visit_1 (cost=0.42..3,938.20 rows=12,189 width=44) (actual time=9.283..27.523 rows=8,347 loops=1)

  • Index Cond: (continue_follow_up = false)
  • Filter: ((reported > ((date_trunc('month'::text, now()) - '1 mon'::interval) - '9 mons'::interval)) OR (reported > ((date_trunc('month'::text, now()) - '1 day'::interval) - '9 mons'::interval)))
  • Rows Removed by Filter: 17455
108. 9.726 76.491 ↓ 1.2 43,086 1

Hash (cost=7,891.34..7,891.34 rows=36,623 width=44) (actual time=76.491..76.491 rows=43,086 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3879kB
109. 31.252 66.765 ↓ 1.2 43,086 1

HashAggregate (cost=7,158.88..7,525.11 rows=36,623 width=44) (actual time=57.450..66.765 rows=43,086 loops=1)

  • Group Key: useview_postnatal_care.patient_id
110. 35.513 35.513 ↑ 1.0 48,409 1

Index Scan using useview_postnatal_care_count_reported_uuid on useview_postnatal_care (cost=0.42..6,915.60 rows=48,656 width=44) (actual time=0.020..35.513 rows=48,409 loops=1)

  • Index Cond: (follow_up_count = '1'::text)
111. 1.134 75.871 ↑ 1.1 1,033 1

Materialize (cost=18,674.69..18,711.22 rows=1,124 width=48) (actual time=70.320..75.871 rows=1,033 loops=1)

112. 3.050 74.737 ↑ 1.1 1,033 1

GroupAggregate (cost=18,674.69..18,697.17 rows=1,124 width=48) (actual time=70.316..74.737 rows=1,033 loops=1)

  • Group Key: assess.chw, 0
113. 5.986 71.687 ↓ 3.7 4,151 1

Sort (cost=18,674.69..18,677.50 rows=1,124 width=77) (actual time=70.299..71.687 rows=4,151 loops=1)

  • Sort Key: assess.chw
  • Sort Method: quicksort Memory: 776kB
114. 1.358 65.701 ↓ 3.7 4,151 1

Nested Loop (cost=2,645.98..18,617.74 rows=1,124 width=77) (actual time=22.196..65.701 rows=4,151 loops=1)

115. 3.147 25.129 ↓ 1.2 5,602 1

Bitmap Heap Scan on useview_assessment assess (cost=2,645.56..7,799.87 rows=4,841 width=81) (actual time=22.159..25.129 rows=5,602 loops=1)

  • Recheck Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone) AND (patient_age_in_years < 5) AND (referral_follow_up = 'true'::text))
  • Heap Blocks: exact=1591
116. 0.079 21.982 ↓ 0.0 0 1

BitmapAnd (cost=2,645.56..2,645.56 rows=4,841 width=0) (actual time=21.982..21.982 rows=0 loops=1)

117. 6.906 6.906 ↓ 1.1 29,891 1

Bitmap Index Scan on useview_assessment_reported_age_uuid (cost=0.00..802.00 rows=28,246 width=0) (actual time=6.906..6.906 rows=29,891 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone) AND (patient_age_in_years < 5))
118. 14.997 14.997 ↓ 1.0 175,711 1

Bitmap Index Scan on useview_assessment_referral_follow_up (cost=0.00..1,840.88 rows=174,848 width=0) (actual time=14.997..14.997 rows=175,711 loops=1)

  • Index Cond: (referral_follow_up = 'true'::text)
119. 39.214 39.214 ↑ 1.0 1 5,602

Index Scan using useview_assessment_follow_up_form_source_id on useview_assessment_follow_up follow_up (cost=0.42..2.22 rows=1 width=45) (actual time=0.007..0.007 rows=1 loops=5,602)

  • Index Cond: (form_source_id = assess.uuid)
  • Filter: ((date(date_trunc('day'::text, reported)) - date(date_trunc('day'::text, assess.reported))) <= 2)
  • Rows Removed by Filter: 0
120. 222.932 274.458 ↑ 3.5 506 1,842

HashAggregate (cost=4,193.43..4,211.02 rows=1,759 width=48) (actual time=0.029..0.149 rows=506 loops=1,842)

  • Group Key: meta.chw, 0
121. 51.526 51.526 ↑ 2.3 1,528 1

Index Scan using form_metadata_formname on form_metadata meta (cost=0.43..4,167.51 rows=3,455 width=76) (actual time=11.154..51.526 rows=1,528 loops=1)

  • Index Cond: (formname = 'community_event'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 50621
122. 38.306 2,438.808 ↑ 1.0 1 1,842

Index Only Scan using contactview_chp_uuid on contactview_chp chp (cost=0.28..3,011.69 rows=1 width=40) (actual time=1.324..1.324 rows=1 loops=1,842)

  • Index Cond: (uuid = chwlist.chw_uuid)
  • Heap Fetches: 1842
123.          

SubPlan (for Index Only Scan)

124. 5.139 1,994.886 ↑ 8.0 1 1,842

Nested Loop Semi Join (cost=0.56..2,080.50 rows=8 width=0) (actual time=1.083..1.083 rows=1 loops=1,842)

  • Join Filter: (meta_1.formname = "*VALUES*".column1)
  • Rows Removed by Join Filter: 2
125. 1,987.518 1,987.518 ↑ 113.0 1 1,842

Index Scan using form_metadata_chw on form_metadata meta_1 (cost=0.56..2,075.37 rows=113 width=15) (actual time=1.052..1.079 rows=1 loops=1,842)

  • Index Cond: (chw = chp.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 606
126. 2.224 2.229 ↑ 1.5 2 2,229

Materialize (cost=0.00..0.05 rows=3 width=32) (actual time=0.000..0.001 rows=2 loops=2,229)

127. 0.005 0.005 ↑ 1.0 3 1

Values Scan on "*VALUES*" (cost=0.00..0.04 rows=3 width=32) (actual time=0.004..0.005 rows=3 loops=1)

128. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.47..22,334.67 rows=18,104 width=36) (never executed)

129. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=0.05..0.08 rows=3 width=32) (never executed)

  • Group Key: "*VALUES*_1".column1
130. 0.000 0.000 ↓ 0.0 0

Values Scan on "*VALUES*_1" (cost=0.00..0.04 rows=3 width=32) (never executed)

131. 0.000 0.000 ↓ 0.0 0

Index Scan using form_metadata_formname on form_metadata meta_2 (cost=0.43..7,384.51 rows=6,035 width=51) (never executed)

  • Index Cond: (formname = "*VALUES*_1".column1)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
132. 0.251 51.455 ↓ 0.0 0 251

Nested Loop (cost=1.99..11.74 rows=12 width=0) (actual time=0.205..0.205 rows=0 loops=251)

133. 0.251 51.204 ↓ 0.0 0 251

Nested Loop (cost=1.71..9.21 rows=1 width=1,396) (actual time=0.204..0.204 rows=0 loops=251)

134. 0.753 50.953 ↓ 0.0 0 251

Nested Loop (cost=1.28..6.55 rows=1 width=37) (actual time=0.203..0.203 rows=0 loops=251)

  • Join Filter: (chw.parent_uuid = cmd_1.parent_uuid)
135. 1.004 6.526 ↑ 1.0 1 251

Nested Loop (cost=0.85..5.29 rows=1 width=110) (actual time=0.025..0.026 rows=1 loops=251)

136. 3.012 3.012 ↑ 1.0 1 251

Index Scan using contactview_metadata_uuid on contactview_metadata chw (cost=0.43..2.65 rows=1 width=73) (actual time=0.011..0.012 rows=1 loops=251)

  • Index Cond: (uuid = chp.uuid)
137. 2.510 2.510 ↑ 1.0 1 251

Index Only Scan using contactview_metadata_uuid on contactview_metadata chwarea (cost=0.43..2.65 rows=1 width=37) (actual time=0.010..0.010 rows=1 loops=251)

  • Index Cond: (uuid = chw.parent_uuid)
  • Heap Fetches: 251
138. 43.674 43.674 ↓ 0.0 0 251

Index Scan using contactview_metadata_parent_uuid on contactview_metadata cmd_1 (cost=0.43..1.24 rows=1 width=36) (actual time=0.174..0.174 rows=0 loops=251)

  • Index Cond: (parent_uuid = chwarea.uuid)
  • Filter: ((type = 'clinic'::text) AND (reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 98
139. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_person_expr_idx8 on pat_person (cost=0.42..2.66 rows=1 width=1,396) (never executed)

  • Index Cond: ((doc ->> '_id'::text) = chp.uuid)
  • Filter: (((doc ->> 'type'::text) = 'person'::text) AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
140. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_health_center_expr_idx8 on pat_health_center (cost=0.28..2.51 rows=1 width=957) (never executed)

  • Index Cond: ((doc ->> '_id'::text) = (pat_person.doc #>> '{parent,_id}'::text[]))
  • Filter: (((doc ->> 'type'::text) = 'health_center'::text) AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
141. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.99..47,494.02 rows=275,731 width=32) (never executed)

142. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.71..39,521.10 rows=22,472 width=1,396) (never executed)

143. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.28..21,594.56 rows=28,087 width=37) (never executed)

144. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.85..20,561.88 rows=1,190 width=73) (never executed)

145. 0.000 0.000 ↓ 0.0 0

Index Scan using contactview_metadata_type on contactview_metadata cmd_2 (cost=0.43..17,530.93 rows=1,190 width=36) (never executed)

  • Index Cond: (type = 'clinic'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
146. 0.000 0.000 ↓ 0.0 0

Index Only Scan using contactview_metadata_uuid on contactview_metadata chwarea_1 (cost=0.43..2.55 rows=1 width=37) (never executed)

  • Index Cond: (uuid = cmd_2.parent_uuid)
  • Heap Fetches: 0
147. 0.000 0.000 ↓ 0.0 0

Index Scan using contactview_metadata_parent_uuid on contactview_metadata chw_1 (cost=0.43..0.72 rows=15 width=73) (never executed)

  • Index Cond: (parent_uuid = chwarea_1.uuid)
148. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_person_expr_idx8 on pat_person pat_person_1 (cost=0.42..0.63 rows=1 width=1,396) (never executed)

  • Index Cond: ((doc ->> '_id'::text) = chw_1.uuid)
  • Filter: (((doc ->> 'type'::text) = 'person'::text) AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
149. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_health_center_expr_idx8 on pat_health_center pat_health_center_1 (cost=0.28..0.31 rows=1 width=957) (never executed)

  • Index Cond: ((doc ->> '_id'::text) = (pat_person_1.doc #>> '{parent,_id}'::text[]))
  • Filter: (((doc ->> 'type'::text) = 'health_center'::text) AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
150. 0.541 354.161 ↓ 0.0 0 251

Nested Loop (cost=1.53..2,745.85 rows=1 width=0) (actual time=1.411..1.411 rows=0 loops=251)

151. 0.450 342.364 ↑ 113.0 1 251

Nested Loop (cost=1.11..2,264.37 rows=113 width=72) (actual time=1.330..1.364 rows=1 loops=251)

152. 340.105 340.105 ↑ 113.0 1 251

Index Scan using form_metadata_chw on form_metadata meta_3 (cost=0.56..2,075.37 rows=113 width=36) (actual time=1.328..1.355 rows=1 loops=251)

  • Index Cond: (chw = chp.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 1050
153. 1.809 1.809 ↑ 1.0 1 201

Index Only Scan using form_metadata_uuid on form_metadata fm (cost=0.56..1.67 rows=1 width=36) (actual time=0.009..0.009 rows=1 loops=201)

  • Index Cond: (uuid = meta_3.uuid)
  • Heap Fetches: 0
154. 0.956 11.256 ↓ 0.0 0 201

Append (cost=0.42..4.14 rows=12 width=38) (actual time=0.056..0.056 rows=0 loops=201)

155. 1.206 1.206 ↓ 0.0 0 201

Index Scan using pat_clinic_expr_idx8 on pat_clinic form_36 (cost=0.42..0.46 rows=1 width=1,030) (actual time=0.006..0.006 rows=0 loops=201)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
156. 1.608 1.608 ↓ 0.0 0 201

Index Scan using pat_form_postnatal_care_expr_idx8 on pat_form_postnatal_care form_37 (cost=0.42..0.45 rows=1 width=26) (actual time=0.008..0.008 rows=0 loops=201)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
  • Rows Removed by Filter: 0
157. 0.197 0.197 ↓ 0.0 0 197

Index Scan using pat_district_hospital_expr_idx8 on pat_district_hospital form_38 (cost=0.14..0.16 rows=1 width=432) (actual time=0.001..0.001 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
158. 1.182 1.182 ↓ 0.0 0 197

Index Scan using pat_feedback_expr_idx8 on pat_feedback form_39 (cost=0.41..0.44 rows=1 width=655) (actual time=0.006..0.006 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
159. 0.394 0.394 ↓ 0.0 0 197

Index Scan using pat_form_expr_idx8 on pat_form form_40 (cost=0.14..0.17 rows=1 width=638) (actual time=0.002..0.002 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
160. 0.788 0.788 ↓ 0.0 0 197

Index Scan using pat_health_center_expr_idx8 on pat_health_center form_41 (cost=0.28..0.31 rows=1 width=957) (actual time=0.004..0.004 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
161. 1.773 1.773 ↓ 0.0 0 197

Index Scan using pat_info_expr_idx8 on pat_info form_42 (cost=0.56..0.66 rows=1 width=297) (actual time=0.009..0.009 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
162. 0.197 0.197 ↓ 0.0 0 197

Index Scan using pat_meta_expr_idx8 on pat_meta form_43 (cost=0.12..0.15 rows=1 width=849) (actual time=0.001..0.001 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
163. 1.379 1.379 ↓ 0.0 0 197

Index Scan using pat_person_expr_idx8 on pat_person form_44 (cost=0.42..0.50 rows=1 width=1,396) (actual time=0.007..0.007 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
164. 0.591 0.591 ↓ 0.0 0 197

Index Scan using pat_traffic_stats_expr_idx8 on pat_traffic_stats form_45 (cost=0.28..0.30 rows=1 width=828) (actual time=0.003..0.003 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
165. 0.197 0.197 ↓ 0.0 0 197

Index Scan using pat_usage_stats_expr_idx8 on pat_usage_stats form_46 (cost=0.14..0.17 rows=1 width=1,075) (actual time=0.001..0.001 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
166. 0.788 0.788 ↓ 0.0 0 197

Index Scan using couchdb_default_expr_idx8 on couchdb_default form_47 (cost=0.28..0.31 rows=1 width=698) (actual time=0.004..0.004 rows=0 loops=197)

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
167. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.53..3,633.95 rows=43 width=36) (never executed)

168. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.98..3,195.25 rows=690 width=74) (never executed)

169. 0.000 0.000 ↓ 0.0 0

Append (cost=0.42..2,048.30 rows=690 width=38) (never executed)

170. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_48 (cost=0.42..2.64 rows=1 width=1,030) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
171. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_form_postnatal_care_expr_expr1_idx1 on pat_form_postnatal_care form_49 (cost=0.42..2,019.86 rows=679 width=26) (never executed)

  • Index Cond: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
172. 0.000 0.000 ↓ 0.0 0

Seq Scan on pat_district_hospital form_50 (cost=0.00..1.28 rows=1 width=432) (never executed)

  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
173. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_51 (cost=0.29..2.51 rows=1 width=655) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
174. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_form_expr_idx9 on pat_form form_52 (cost=0.14..2.36 rows=1 width=638) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
175. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_53 (cost=0.28..2.50 rows=1 width=957) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
176. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_info_expr_idx9 on pat_info form_54 (cost=0.43..2.66 rows=1 width=297) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
177. 0.000 0.000 ↓ 0.0 0

Seq Scan on pat_meta form_55 (cost=0.00..1.02 rows=1 width=849) (never executed)

  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
178. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_person_expr_idx9 on pat_person form_56 (cost=0.42..2.65 rows=1 width=1,396) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
179. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_57 (cost=0.28..2.50 rows=1 width=828) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
180. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_usage_stats_expr_idx9 on pat_usage_stats form_58 (cost=0.14..2.36 rows=1 width=1,075) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
181. 0.000 0.000 ↓ 0.0 0

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_59 (cost=0.28..2.51 rows=1 width=698) (never executed)

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
182. 0.000 0.000 ↓ 0.0 0

Index Only Scan using form_metadata_uuid on form_metadata fm_1 (cost=0.56..1.66 rows=1 width=36) (never executed)

  • Index Cond: (uuid = (form_48.doc ->> '_id'::text))
  • Heap Fetches: 0
183. 0.000 0.000 ↓ 0.0 0

Index Scan using form_metadata_uuid on form_metadata meta_4 (cost=0.56..0.64 rows=1 width=72) (never executed)

  • Index Cond: (uuid = fm_1.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
184. 73,381.596 81,746.118 ↑ 1.3 1,651 1,842

GroupAggregate (cost=34,745.16..35,364.35 rows=2,085 width=48) (actual time=0.062..44.379 rows=1,651 loops=1,842)

  • Group Key: useview_households_visited.chw, 0
185. 8,323.434 8,364.522 ↑ 1.0 58,985 1,842

Sort (cost=34,745.16..34,894.74 rows=59,834 width=76) (actual time=0.044..4.541 rows=58,985 loops=1,842)

  • Sort Key: useview_households_visited.chw
  • Sort Method: quicksort Memory: 9831kB
186. 34.905 41.088 ↑ 1.0 58,985 1

Bitmap Heap Scan on useview_households_visited (cost=1,459.78..29,997.72 rows=59,834 width=76) (actual time=9.013..41.088 rows=58,985 loops=1)

  • Recheck Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Heap Blocks: exact=17795
187. 6.183 6.183 ↑ 1.0 58,985 1

Bitmap Index Scan on households_date_visited_chw_hh (cost=0.00..1,444.82 rows=59,834 width=0) (actual time=6.183..6.183 rows=58,985 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
188. 1,076.250 1,081.254 ↑ 1.6 1,245 1,842

HashAggregate (cost=8,448.66..8,469.07 rows=2,041 width=152) (actual time=0.016..0.587 rows=1,245 loops=1,842)

  • Group Key: population.chp_area_uuid, 0
189. 5.004 5.004 ↑ 1.2 5,131 1

Index Scan using useview_population_demographics_reported_idx on useview_population_demographics population (cost=0.45..6,283.81 rows=5,972 width=87) (actual time=0.054..5.004 rows=5,131 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
190. 1.385 57.685 ↑ 1.9 1,089 1

Materialize (cost=8,486.49..8,839.86 rows=2,111 width=64) (actual time=23.540..57.685 rows=1,089 loops=1)

191. 29.623 56.300 ↑ 1.9 1,089 1

GroupAggregate (cost=8,486.49..8,813.47 rows=2,111 width=64) (actual time=23.536..56.300 rows=1,089 loops=1)

  • Group Key: survey.chw, 0
192. 16.537 26.677 ↑ 1.0 13,016 1

Sort (cost=8,486.49..8,520.48 rows=13,594 width=88) (actual time=23.482..26.677 rows=13,016 loops=1)

  • Sort Key: survey.chw
  • Sort Method: quicksort Memory: 2215kB
193. 10.140 10.140 ↑ 1.0 13,016 1

Index Scan using useview_family_survey_uuid_reported_chw on useview_family_survey survey (cost=0.45..7,553.22 rows=13,594 width=88) (actual time=0.029..10.140 rows=13,016 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
194. 1,068.889 1,147.566 ↑ 71.4 1,123 1,842

HashAggregate (cost=11,362.68..12,164.07 rows=80,139 width=48) (actual time=0.077..0.623 rows=1,123 loops=1,842)

  • Group Key: contactview_metadata_1.parent_uuid, 0
195. 78.677 78.677 ↑ 1.0 239,512 1

Index Scan using contactview_metadata_type on contactview_metadata contactview_metadata_1 (cost=0.43..9,512.20 rows=246,730 width=40) (actual time=0.032..78.677 rows=239,512 loops=1)

  • Index Cond: (type = 'clinic'::text)
196. 163.765 2,155.140 ↑ 1.7 1,356 1,842

Materialize (cost=169,220.43..169,300.76 rows=2,295 width=48) (actual time=1.081..1.170 rows=1,356 loops=1,842)

197. 0.344 1,991.375 ↓ 1.2 2,708 1

Subquery Scan on sync (cost=169,220.43..169,289.28 rows=2,295 width=48) (actual time=1,989.414..1,991.375 rows=2,708 loops=1)

198. 1,298.920 1,991.031 ↓ 1.2 2,708 1

HashAggregate (cost=169,220.43..169,266.33 rows=2,295 width=48) (actual time=1,989.412..1,991.031 rows=2,708 loops=1)

  • Group Key: useview_chp_sync.chw_uuid, 0
199. 692.111 692.111 ↑ 1.0 5,332,505 1

Seq Scan on useview_chp_sync (cost=0.00..129,226.39 rows=5,332,539 width=48) (actual time=0.012..692.111 rows=5,332,505 loops=1)

200. 134.542 517.602 ↑ 2.0 1,110 1,842

Materialize (cost=60,538.51..60,593.04 rows=2,181 width=48) (actual time=0.208..0.281 rows=1,110 loops=1,842)

201. 0.240 383.060 ↓ 1.0 2,222 1

Subquery Scan on population_all_time (cost=60,538.51..60,582.13 rows=2,181 width=48) (actual time=382.320..383.060 rows=2,222 loops=1)

202. 232.753 382.820 ↓ 1.0 2,222 1

HashAggregate (cost=60,538.51..60,560.32 rows=2,181 width=48) (actual time=382.318..382.820 rows=2,222 loops=1)

  • Group Key: population_1.chp_area_uuid, 0
203. 150.067 150.067 ↑ 1.0 977,458 1

Seq Scan on useview_population_demographics population_1 (cost=0.00..53,207.58 rows=977,458 width=77) (actual time=0.011..150.067 rows=977,458 loops=1)

204. 1.357 146.392 ↓ 6.6 1,312 1

Materialize (cost=4,249.75..4,362.94 rows=200 width=56) (actual time=125.625..146.392 rows=1,312 loops=1)

205. 17.154 145.035 ↓ 6.6 1,312 1

GroupAggregate (cost=4,249.75..4,360.44 rows=200 width=56) (actual time=125.621..145.035 rows=1,312 loops=1)

  • Group Key: "*SELECT* 1".reported_by, 0
206. 11.258 127.881 ↑ 1.0 6,137 1

Sort (cost=4,249.75..4,265.13 rows=6,154 width=80) (actual time=125.547..127.881 rows=6,137 loops=1)

  • Sort Key: "*SELECT* 1".reported_by
  • Sort Method: quicksort Memory: 1056kB
207. 0.995 116.623 ↑ 1.0 6,137 1

Result (cost=0.00..3,862.44 rows=6,154 width=80) (actual time=1.878..116.623 rows=6,137 loops=1)

208. 0.846 115.628 ↑ 1.0 6,137 1

Append (cost=0.00..3,800.90 rows=6,154 width=76) (actual time=1.877..115.628 rows=6,137 loops=1)

209. 0.011 4.987 ↓ 1.0 46 1

Subquery Scan on *SELECT* 1 (cost=0.00..350.30 rows=44 width=78) (actual time=1.875..4.987 rows=46 loops=1)

210. 4.976 4.976 ↓ 1.0 46 1

Seq Scan on useview_fp_registration (cost=0.00..349.86 rows=44 width=256) (actual time=1.871..4.976 rows=46 loops=1)

  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 4816
211. 0.053 4.568 ↑ 1.0 294 1

Subquery Scan on *SELECT* 2 (cost=0.44..334.22 rows=298 width=78) (actual time=0.055..4.568 rows=294 loops=1)

212. 4.515 4.515 ↑ 1.0 294 1

Index Scan using index_useview_person_fp_registration_reported_chw_patient_id on useview_person_fp_registration (cost=0.44..331.24 rows=298 width=256) (actual time=0.054..4.515 rows=294 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Filter: (patient_age_in_years >= 15)
  • Rows Removed by Filter: 46
213. 0.983 105.227 ↑ 1.0 5,797 1

Subquery Scan on *SELECT* 3 (cost=0.45..3,085.61 rows=5,812 width=76) (actual time=0.110..105.227 rows=5,797 loops=1)

214. 104.244 104.244 ↑ 1.0 5,797 1

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_1 (cost=0.45..3,027.49 rows=5,812 width=254) (actual time=0.108..104.244 rows=5,797 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
215. 1.682 352.157 ↓ 8.2 1,630 1

Materialize (cost=17,789.69..17,809.69 rows=200 width=80) (actual time=263.939..352.157 rows=1,630 loops=1)

216. 75.803 350.475 ↓ 8.2 1,630 1

GroupAggregate (cost=17,789.69..17,807.19 rows=200 width=80) (actual time=263.933..350.475 rows=1,630 loops=1)

  • Group Key: assess_u1fu_pnc_aggregated.chw, 0
217. 59.858 274.672 ↓ 184.3 36,861 1

Sort (cost=17,789.69..17,790.19 rows=200 width=96) (actual time=263.909..274.672 rows=36,861 loops=1)

  • Sort Key: assess_u1fu_pnc_aggregated.chw
  • Sort Method: quicksort Memory: 7444kB
218. 5.920 214.814 ↓ 184.3 36,861 1

Subquery Scan on assess_u1fu_pnc_aggregated (cost=17,591.26..17,782.04 rows=200 width=96) (actual time=194.430..214.814 rows=36,861 loops=1)

219. 8.923 208.894 ↓ 184.3 36,861 1

Unique (cost=17,591.26..17,780.04 rows=200 width=100) (actual time=194.416..208.894 rows=36,861 loops=1)

220. 108.522 199.971 ↓ 1.1 40,031 1

Sort (cost=17,591.26..17,685.65 rows=37,756 width=100) (actual time=194.413..199.971 rows=40,031 loops=1)

  • Sort Key: useview_assessment.patient_id, useview_assessment.reported DESC
  • Sort Method: quicksort Memory: 8144kB
221. 4.105 91.449 ↓ 1.1 40,031 1

Append (cost=0.45..14,720.97 rows=37,756 width=100) (actual time=0.048..91.449 rows=40,031 loops=1)

222. 35.979 35.979 ↑ 1.0 33,495 1

Index Scan using useview_assessment_reported on useview_assessment (cost=0.45..10,604.01 rows=35,084 width=94) (actual time=0.047..35.979 rows=33,495 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
223. 2.993 2.993 ↓ 1.0 740 1

Index Scan using useview_u1_follow_up_reported_chw_uuid on useview_u1_follow_up (cost=0.32..465.02 rows=735 width=161) (actual time=0.077..2.993 rows=740 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
224. 48.372 48.372 ↓ 3.0 5,796 1

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_2 (cost=0.45..3,085.60 rows=1,937 width=185) (actual time=0.129..48.372 rows=5,796 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Filter: is_date((date_of_birth)::character varying)
  • Rows Removed by Filter: 1
225. 0.057 14.612 ↓ 1.2 59 1

Materialize (cost=251.08..254.44 rows=51 width=56) (actual time=11.033..14.612 rows=59 loops=1)

226. 3.516 14.555 ↓ 1.2 59 1

GroupAggregate (cost=251.08..253.80 rows=51 width=56) (actual time=11.030..14.555 rows=59 loops=1)

  • Group Key: dr.chw, 0
227. 0.175 11.039 ↓ 1.8 92 1

Sort (cost=251.08..251.21 rows=52 width=1,622) (actual time=10.984..11.039 rows=92 loops=1)

  • Sort Key: dr.chw
  • Sort Method: quicksort Memory: 210kB
228. 5.013 10.864 ↓ 1.8 92 1

Hash Right Join (cost=65.55..249.60 rows=52 width=1,622) (actual time=4.726..10.864 rows=92 loops=1)

  • Hash Cond: ((form.doc ->> '_id'::text) = dr.uuid)
229. 0.069 4.965 ↑ 1.0 638 1

Append (cost=0.42..182.68 rows=649 width=1,582) (actual time=0.038..4.965 rows=638 loops=1)

230. 0.008 0.008 ↓ 0.0 0 1

Index Scan using pat_clinic_expr_idx9 on pat_clinic form (cost=0.42..2.64 rows=1 width=1,030) (actual time=0.008..0.008 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
231. 4.826 4.826 ↑ 1.0 638 1

Seq Scan on pat_form_death_report form_1 (cost=0.00..154.57 rows=638 width=1,595) (actual time=0.028..4.826 rows=638 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
232. 0.021 0.021 ↓ 0.0 0 1

Seq Scan on pat_district_hospital form_2 (cost=0.00..1.21 rows=1 width=432) (actual time=0.021..0.021 rows=0 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 14
233. 0.006 0.006 ↓ 0.0 0 1

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_3 (cost=0.29..2.51 rows=1 width=655) (actual time=0.006..0.006 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
234. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_form_expr_idx9 on pat_form form_4 (cost=0.14..2.36 rows=1 width=638) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
235. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_5 (cost=0.28..2.50 rows=1 width=957) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
236. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_info_expr_idx9 on pat_info form_6 (cost=0.43..2.65 rows=1 width=297) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
237. 0.005 0.005 ↓ 0.0 0 1

Seq Scan on pat_meta form_7 (cost=0.00..1.01 rows=1 width=849) (actual time=0.005..0.005 rows=0 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 1
238. 0.007 0.007 ↓ 0.0 0 1

Index Scan using pat_person_expr_idx9 on pat_person form_8 (cost=0.42..2.64 rows=1 width=1,396) (actual time=0.007..0.007 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
239. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_9 (cost=0.28..2.49 rows=1 width=828) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
240. 0.002 0.002 ↓ 0.0 0 1

Index Scan using pat_usage_stats_expr_idx9 on pat_usage_stats form_10 (cost=0.14..2.36 rows=1 width=1,075) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
241. 0.004 0.004 ↓ 0.0 0 1

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_11 (cost=0.28..2.50 rows=1 width=698) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
242. 0.031 0.886 ↓ 1.8 92 1

Hash (cost=64.48..64.48 rows=52 width=72) (actual time=0.886..0.886 rows=92 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
243. 0.855 0.855 ↓ 1.8 92 1

Index Scan using form_metadata_formname on form_metadata dr (cost=0.43..64.48 rows=52 width=72) (actual time=0.372..0.855 rows=92 loops=1)

  • Index Cond: (formname = 'death_report'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 546
244. 0.003 100.784 ↑ 2.0 1 1

Materialize (cost=8,180.59..8,180.66 rows=2 width=48) (actual time=100.784..100.784 rows=1 loops=1)

245. 0.008 100.781 ↑ 2.0 1 1

GroupAggregate (cost=8,180.59..8,180.63 rows=2 width=48) (actual time=100.781..100.781 rows=1 loops=1)

  • Group Key: "*SELECT* 1_1".chw_uuid, 0
246. 0.007 100.773 ↑ 1.0 2 1

Sort (cost=8,180.59..8,180.60 rows=2 width=40) (actual time=100.773..100.773 rows=2 loops=1)

  • Sort Key: "*SELECT* 1_1".chw_uuid
  • Sort Method: quicksort Memory: 25kB
247. 0.004 100.766 ↑ 1.0 2 1

Result (cost=7,944.61..8,180.58 rows=2 width=40) (actual time=78.389..100.766 rows=2 loops=1)

248. 0.002 100.762 ↑ 1.0 2 1

Append (cost=7,944.61..8,180.56 rows=2 width=36) (actual time=78.387..100.762 rows=2 loops=1)

249. 0.040 78.396 ↑ 1.0 1 1

Subquery Scan on *SELECT* 1_1 (cost=7,944.61..7,944.84 rows=1 width=36) (actual time=78.386..78.396 rows=1 loops=1)

  • Filter: (("*SELECT* 1_1".reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND ("*SELECT* 1_1".reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 17
250. 0.014 78.356 ↓ 3.6 18 1

Unique (cost=7,944.61..7,944.63 rows=5 width=80) (actual time=78.340..78.356 rows=18 loops=1)

251. 0.054 78.342 ↓ 11.6 58 1

Sort (cost=7,944.61..7,944.62 rows=5 width=80) (actual time=78.338..78.342 rows=58 loops=1)

  • Sort Key: pv_2.patient_id
  • Sort Method: quicksort Memory: 33kB
252. 26.885 78.288 ↓ 11.6 58 1

Hash Join (cost=232.34..7,944.55 rows=5 width=80) (actual time=19.645..78.288 rows=58 loops=1)

  • Hash Cond: (pv_2.patient_id = (form_12.doc #>> '{fields,inputs,contact,_id}'::text[]))
253. 32.900 32.900 ↓ 1.0 177,846 1

Seq Scan on useview_pregnancy_visit pv_2 (cost=0.00..6,823.00 rows=177,831 width=36) (actual time=0.007..32.900 rows=177,846 loops=1)

  • Filter: (patient_id <> ''::text)
  • Rows Removed by Filter: 90
254. 4.611 18.503 ↓ 638.0 638 1

Hash (cost=232.33..232.33 rows=1 width=1,626) (actual time=18.503..18.503 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1052kB
255. 8.580 13.892 ↓ 638.0 638 1

Hash Join (cost=48.28..232.33 rows=1 width=1,626) (actual time=0.417..13.892 rows=638 loops=1)

  • Hash Cond: ((form_12.doc ->> '_id'::text) = dr_1.uuid)
256. 0.073 4.945 ↑ 1.0 638 1

Append (cost=0.42..182.68 rows=649 width=1,582) (actual time=0.020..4.945 rows=638 loops=1)

257. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_12 (cost=0.42..2.64 rows=1 width=1,030) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
258. 4.822 4.822 ↑ 1.0 638 1

Seq Scan on pat_form_death_report form_13 (cost=0.00..154.57 rows=638 width=1,595) (actual time=0.014..4.822 rows=638 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
259. 0.010 0.010 ↓ 0.0 0 1

Seq Scan on pat_district_hospital form_14 (cost=0.00..1.21 rows=1 width=432) (actual time=0.010..0.010 rows=0 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 14
260. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_15 (cost=0.29..2.51 rows=1 width=655) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
261. 0.006 0.006 ↓ 0.0 0 1

Index Scan using pat_form_expr_idx9 on pat_form form_16 (cost=0.14..2.36 rows=1 width=638) (actual time=0.006..0.006 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
262. 0.002 0.002 ↓ 0.0 0 1

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_17 (cost=0.28..2.50 rows=1 width=957) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
263. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_info_expr_idx9 on pat_info form_18 (cost=0.43..2.65 rows=1 width=297) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
264. 0.004 0.004 ↓ 0.0 0 1

Seq Scan on pat_meta form_19 (cost=0.00..1.01 rows=1 width=849) (actual time=0.004..0.004 rows=0 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 1
265. 0.003 0.003 ↓ 0.0 0 1

Index Scan using pat_person_expr_idx9 on pat_person form_20 (cost=0.42..2.64 rows=1 width=1,396) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
266. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_21 (cost=0.28..2.49 rows=1 width=828) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
267. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_usage_stats_expr_idx9 on pat_usage_stats form_22 (cost=0.14..2.36 rows=1 width=1,075) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
268. 0.003 0.003 ↓ 0.0 0 1

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_23 (cost=0.28..2.50 rows=1 width=698) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
269. 0.162 0.367 ↑ 1.3 638 1

Hash (cost=37.48..37.48 rows=831 width=80) (actual time=0.367..0.367 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
270. 0.205 0.205 ↑ 1.3 638 1

Index Scan using form_metadata_formname on form_metadata dr_1 (cost=0.43..37.48 rows=831 width=80) (actual time=0.015..0.205 rows=638 loops=1)

  • Index Cond: (formname = 'death_report'::text)
271. 0.020 22.364 ↑ 1.0 1 1

Subquery Scan on *SELECT* 2_1 (cost=235.66..235.71 rows=1 width=36) (actual time=22.358..22.364 rows=1 loops=1)

  • Filter: (("*SELECT* 2_1".reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND ("*SELECT* 2_1".reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 15
272. 0.010 22.344 ↓ 16.0 16 1

Unique (cost=235.66..235.66 rows=1 width=80) (actual time=22.331..22.344 rows=16 loops=1)

273. 0.041 22.334 ↓ 40.0 40 1

Sort (cost=235.66..235.66 rows=1 width=80) (actual time=22.331..22.334 rows=40 loops=1)

  • Sort Key: pc_1.patient_id
  • Sort Method: quicksort Memory: 30kB
274. 4.404 22.293 ↓ 40.0 40 1

Nested Loop (cost=48.71..235.65 rows=1 width=80) (actual time=3.021..22.293 rows=40 loops=1)

275. 8.657 14.061 ↓ 638.0 638 1

Hash Join (cost=48.28..232.33 rows=1 width=1,626) (actual time=0.438..14.061 rows=638 loops=1)

  • Hash Cond: ((form_24.doc ->> '_id'::text) = dr_2.uuid)
276. 0.080 5.027 ↑ 1.0 638 1

Append (cost=0.42..182.68 rows=649 width=1,582) (actual time=0.033..5.027 rows=638 loops=1)

277. 0.013 0.013 ↓ 0.0 0 1

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_24 (cost=0.42..2.64 rows=1 width=1,030) (actual time=0.013..0.013 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
278. 4.873 4.873 ↑ 1.0 638 1

Seq Scan on pat_form_death_report form_25 (cost=0.00..154.57 rows=638 width=1,595) (actual time=0.019..4.873 rows=638 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
279. 0.022 0.022 ↓ 0.0 0 1

Seq Scan on pat_district_hospital form_26 (cost=0.00..1.21 rows=1 width=432) (actual time=0.022..0.022 rows=0 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 14
280. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_27 (cost=0.29..2.51 rows=1 width=655) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
281. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_form_expr_idx9 on pat_form form_28 (cost=0.14..2.36 rows=1 width=638) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
282. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_29 (cost=0.28..2.50 rows=1 width=957) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
283. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_info_expr_idx9 on pat_info form_30 (cost=0.43..2.65 rows=1 width=297) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
284. 0.005 0.005 ↓ 0.0 0 1

Seq Scan on pat_meta form_31 (cost=0.00..1.01 rows=1 width=849) (actual time=0.005..0.005 rows=0 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 1
285. 0.006 0.006 ↓ 0.0 0 1

Index Scan using pat_person_expr_idx9 on pat_person form_32 (cost=0.42..2.64 rows=1 width=1,396) (actual time=0.006..0.006 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
286. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_33 (cost=0.28..2.49 rows=1 width=828) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
287. 0.003 0.003 ↓ 0.0 0 1

Index Scan using pat_usage_stats_expr_idx9 on pat_usage_stats form_34 (cost=0.14..2.36 rows=1 width=1,075) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
288. 0.003 0.003 ↓ 0.0 0 1

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_35 (cost=0.28..2.50 rows=1 width=698) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
289. 0.169 0.377 ↑ 1.3 638 1

Hash (cost=37.48..37.48 rows=831 width=80) (actual time=0.377..0.377 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
290. 0.208 0.208 ↑ 1.3 638 1

Index Scan using form_metadata_formname on form_metadata dr_2 (cost=0.43..37.48 rows=831 width=80) (actual time=0.015..0.208 rows=638 loops=1)

  • Index Cond: (formname = 'death_report'::text)
291. 3.828 3.828 ↓ 0.0 0 638

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pc_1 (cost=0.42..3.31 rows=1 width=36) (actual time=0.006..0.006 rows=0 loops=638)

  • Index Cond: (patient_id = (form_24.doc #>> '{fields,inputs,contact,_id}'::text[]))
  • Filter: ((patient_id <> ''::text) AND (date_part('year'::text, age((CURRENT_DATE)::timestamp with time zone, ((date_of_birth)::date)::timestamp with time zone)) >= '12'::double precision))
  • Rows Removed by Filter: 0
292. 1.236 524.895 ↑ 1.1 1,638 1

Materialize (cost=39,802.03..41,316.00 rows=1,777 width=48) (actual time=338.563..524.895 rows=1,638 loops=1)

293. 150.734 523.659 ↑ 1.1 1,638 1

GroupAggregate (cost=39,802.03..41,293.79 rows=1,777 width=48) (actual time=338.561..523.659 rows=1,638 loops=1)

  • Group Key: useview_home_visit.reported_by, 0
294. 247.036 372.925 ↑ 1.0 146,223 1

Sort (cost=39,802.03..40,170.53 rows=147,399 width=77) (actual time=338.487..372.925 rows=146,223 loops=1)

  • Sort Key: useview_home_visit.reported_by
  • Sort Method: quicksort Memory: 26707kB
295. 125.889 125.889 ↑ 1.0 146,223 1

Index Scan using useview_home_visit_reported_idx on useview_home_visit (cost=0.46..27,148.29 rows=147,399 width=77) (actual time=0.064..125.889 rows=146,223 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
296. 0.110 13.309 ↑ 1.9 106 1

Materialize (cost=2,136.34..2,850.33 rows=200 width=97) (actual time=11.481..13.309 rows=106 loops=1)

297. 1.369 13.199 ↑ 1.9 106 1

GroupAggregate (cost=2,136.34..2,847.83 rows=200 width=97) (actual time=11.478..13.199 rows=106 loops=1)

  • Group Key: "*SELECT* 1_2".reported_by, 0
298. 1.458 11.830 ↑ 11.6 1,435 1

Sort (cost=2,136.34..2,178.07 rows=16,694 width=178) (actual time=11.453..11.830 rows=1,435 loops=1)

  • Sort Key: "*SELECT* 1_2".reported_by
  • Sort Method: quicksort Memory: 430kB
299. 1.189 10.372 ↑ 11.6 1,435 1

Merge Left Join (cost=707.91..965.50 rows=16,694 width=178) (actual time=8.855..10.372 rows=1,435 loops=1)

  • Merge Cond: ("*SELECT* 1_2".form_uuid = useview_fp_follow_up_prospective_ke.source_id)
300. 2.373 4.684 ↑ 1.0 1,435 1

Sort (cost=485.03..488.62 rows=1,436 width=122) (actual time=4.522..4.684 rows=1,435 loops=1)

  • Sort Key: "*SELECT* 1_2".form_uuid
  • Sort Method: quicksort Memory: 430kB
301. 0.149 2.311 ↑ 1.0 1,435 1

Append (cost=0.30..409.73 rows=1,436 width=122) (actual time=0.052..2.311 rows=1,435 loops=1)

302. 0.047 1.121 ↑ 1.0 363 1

Subquery Scan on *SELECT* 1_2 (cost=0.30..103.83 rows=363 width=122) (actual time=0.051..1.121 rows=363 loops=1)

303. 0.047 1.074 ↑ 1.0 363 1

Result (cost=0.30..100.20 rows=363 width=122) (actual time=0.049..1.074 rows=363 loops=1)

304. 0.035 1.027 ↑ 1.0 363 1

Append (cost=0.30..96.57 rows=363 width=121) (actual time=0.047..1.027 rows=363 loops=1)

305. 0.136 0.136 ↑ 1.0 122 1

Index Scan using index_useview_fp_follow_up_prospective_ke_reported_patient_id_u on useview_fp_follow_up_prospective_ke useview_fp_follow_up_prospective_ke_1 (cost=0.30..26.31 rows=123 width=121) (actual time=0.047..0.136 rows=122 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
306. 0.092 0.092 ↓ 1.0 122 1

Index Scan using index_useview_fp_follow_up_short_term_ke_reported_patient_id_uu on useview_fp_follow_up_short_term_ke useview_fp_follow_up_short_term_ke_1 (cost=0.30..20.14 rows=121 width=121) (actual time=0.025..0.092 rows=122 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
307. 0.764 0.764 ↑ 1.0 119 1

Seq Scan on useview_fp_follow_up_long_term_ke useview_fp_follow_up_long_term_ke_1 (cost=0.00..48.30 rows=119 width=121) (actual time=0.533..0.764 rows=119 loops=1)

  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 594
308. 0.137 1.041 ↑ 1.0 1,072 1

Subquery Scan on *SELECT* 2_2 (cost=0.31..298.72 rows=1,073 width=122) (actual time=0.055..1.041 rows=1,072 loops=1)

309. 0.904 0.904 ↑ 1.0 1,072 1

Index Scan using index_useview_fp_registration_ke_reported_patient_id_uuid on useview_fp_registration_ke (cost=0.31..287.99 rows=1,073 width=122) (actual time=0.052..0.904 rows=1,072 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
310. 3.784 4.499 ↑ 1.0 2,319 1

Sort (cost=222.88..228.69 rows=2,325 width=89) (actual time=4.317..4.499 rows=2,319 loops=1)

  • Sort Key: useview_fp_follow_up_prospective_ke.source_id
  • Sort Method: quicksort Memory: 424kB
311. 0.232 0.715 ↓ 1.0 2,326 1

Append (cost=0.00..92.88 rows=2,325 width=89) (actual time=0.006..0.715 rows=2,326 loops=1)

312. 0.195 0.195 ↑ 1.0 930 1

Seq Scan on useview_fp_follow_up_prospective_ke (cost=0.00..32.30 rows=930 width=88) (actual time=0.006..0.195 rows=930 loops=1)

313. 0.153 0.153 ↓ 1.0 683 1

Seq Scan on useview_fp_follow_up_short_term_ke (cost=0.00..23.82 rows=682 width=89) (actual time=0.005..0.153 rows=683 loops=1)

314. 0.135 0.135 ↑ 1.0 713 1

Seq Scan on useview_fp_follow_up_long_term_ke (cost=0.00..25.13 rows=713 width=89) (actual time=0.006..0.135 rows=713 loops=1)

Planning time : 43.841 ms
Execution time : 112,130.811 ms