explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bPda

Settings
# exclusive inclusive rows x rows loops node
1. 63.828 111,812.022 ↓ 1,842.0 1,842 1

GroupAggregate (cost=856,166.14..856,167.69 rows=1 width=650) (actual time=111,748.063..111,812.022 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: 909
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 135.696 ms, Inlining 52.786 ms, Optimization 9255.085 ms, Emission 6723.048 ms, Total 16166.614 ms
2.          

CTE fp

3. 5.634 134.522 ↓ 6.6 1,312 1

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

  • Group Key: "*SELECT* 1_2".reported_by, 0
4. 9.732 128.888 ↑ 1.0 6,137 1

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

  • Sort Key: "*SELECT* 1_2".reported_by
  • Sort Method: quicksort Memory: 1056kB
5. 1.019 119.156 ↑ 1.0 6,137 1

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

6. 0.858 118.137 ↑ 1.0 6,137 1

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

7. 0.015 5.292 ↓ 1.0 46 1

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

8. 5.277 5.277 ↓ 1.0 46 1

Seq Scan on useview_fp_registration (cost=0.00..349.86 rows=44 width=256) (actual time=1.809..5.277 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
9. 0.054 4.495 ↑ 1.0 294 1

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

10. 4.441 4.441 ↑ 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.062..4.441 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
11. 1.049 107.492 ↑ 1.0 5,797 1

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

12. 106.443 106.443 ↑ 1.0 5,797 1

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_2 (cost=0.45..3,027.49 rows=5,812 width=254) (actual time=0.094..106.443 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))
13. 15.211 111,748.194 ↓ 921.0 1,842 1

Sort (cost=851,805.69..851,805.70 rows=2 width=1,986) (actual time=111,747.948..111,748.194 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
14. 6.690 111,732.983 ↓ 921.0 1,842 1

Merge Left Join (cost=841,881.93..851,805.68 rows=2 width=1,986) (actual time=21,880.842..111,732.983 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1_1".reported_by)
  • Join Filter: (chwlist.interval_number = (0))
15. 8.305 111,712.238 ↓ 921.0 1,842 1

Merge Left Join (cost=839,745.60..848,954.81 rows=2 width=1,934) (actual time=21,869.236..111,712.238 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = useview_home_visit.reported_by)
  • Join Filter: (chwlist.interval_number = (0))
16. 3.312 111,171.241 ↓ 921.0 1,842 1

Merge Left Join (cost=799,943.68..807,634.26 rows=2 width=1,926) (actual time=21,527.434..111,171.241 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1".chw_uuid)
  • Join Filter: (chwlist.interval_number = (0))
17. 4.996 111,063.004 ↓ 921.0 1,842 1

Merge Left Join (cost=791,763.09..799,453.57 rows=2 width=1,918) (actual time=21,422.502..111,063.004 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = dr.chw)
  • Join Filter: (chwlist.interval_number = (0))
18. 7.917 111,043.278 ↓ 921.0 1,842 1

Merge Left Join (cost=791,512.00..799,198.97 rows=2 width=1,902) (actual time=21,411.570..111,043.278 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess_u1fu_pnc_aggregated.chw)
  • Join Filter: (chwlist.interval_number = (0))
19. 235.694 110,670.348 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=773,722.32..781,388.76 rows=2 width=1,862) (actual time=21,141.078..110,670.348 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = fp.chw_uuid) AND (chwlist.interval_number = fp.interval_number))
  • Rows Removed by Join Filter: 2415417
20. 196.850 110,022.046 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=773,722.32..781,376.76 rows=2 width=1,846) (actual time=21,005.807..110,022.046 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
21. 243.807 109,256.018 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=713,183.80..720,712.83 rows=2 width=1,874) (actual time=20,578.858..109,256.018 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
22. 191.708 106,746.551 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=543,963.96..551,338.08 rows=2 width=1,866) (actual time=18,480.158..106,746.551 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
23. 8.059 105,379.647 ↓ 1,842.0 1,842 1

Merge Left Join (cost=532,601.29..537,170.54 rows=1 width=1,822) (actual time=18,349.023..105,379.647 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = survey.chw)
  • Join Filter: (chwlist.interval_number = (0))
24. 208.256 105,311.846 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=524,114.79..528,325.27 rows=1 width=1,798) (actual time=18,324.776..105,311.846 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
25. 328.966 103,978.128 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=515,666.13..519,784.76 rows=1 width=1,686) (actual time=18,298.302..103,978.128 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
26. 16.903 23,255.072 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=480,920.98..484,347.44 rows=1 width=1,678) (actual time=18,207.694..23,255.072 rows=1,842 loops=1)

  • Join Filter: (chwlist.interval_number = 0)
27. 86.318 20,628.055 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=480,920.70..481,335.73 rows=1 width=1,674) (actual time=18,206.903..20,628.055 rows=1,842 loops=1)

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

Merge Left Join (cost=476,727.27..477,080.74 rows=1 width=1,666) (actual time=18,153.964..20,259.911 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess.chw)
  • Join Filter: (chwlist.interval_number = (0))
29. 55.891 20,173.095 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=458,052.58..458,366.63 rows=1 width=1,658) (actual time=18,079.689..20,173.095 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=424,042.35..424,349.41 rows=1 width=1,650) (actual time=17,623.392..19,535.132 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=422,237.63..422,498.73 rows=1 width=1,554) (actual time=17,614.631..18,847.475 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=421,841.40..422,064.98 rows=1 width=1,538) (actual time=17,612.699..18,413.250 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
33. 10.147 17,385.402 ↓ 1,842.0 1,842 1

Merge Left Join (cost=404,249.68..404,419.99 rows=1 width=1,530) (actual time=17,369.266..17,385.402 rows=1,842 loops=1)

  • Merge Cond: ((chwlist.chw_uuid = anc_pnc_u1fu.chw_uuid) AND (chwlist.interval_number = anc_pnc_u1fu.interval_number))
34. 6.138 16,171.789 ↓ 1,842.0 1,842 1

Sort (cost=32,500.12..32,500.12 rows=1 width=1,482) (actual time=16,170.221..16,171.789 rows=1,842 loops=1)

  • Sort Key: chwlist.chw_uuid, chwlist.interval_number
  • Sort Method: quicksort Memory: 938kB
35. 0.989 16,165.651 ↓ 1,842.0 1,842 1

Hash Right Join (cost=32,205.40..32,500.11 rows=1 width=1,482) (actual time=16,159.815..16,165.651 rows=1,842 loops=1)

  • Hash Cond: ((chwview_assessment.chw_uuid = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
36. 28.011 58.239 ↑ 1.3 1,624 1

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

  • Group Key: chwview_assessment.chw_uuid, 0
37. 22.578 30.228 ↑ 1.1 33,495 1

Bitmap Heap Scan on chwview_assessment (cost=682.66..20,258.07 rows=35,328 width=352) (actual time=7.982..30.228 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
38. 7.650 7.650 ↑ 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=7.650..7.650 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))
39. 0.947 16,106.423 ↓ 1,842.0 1,842 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 492kB
40. 0.867 16,105.476 ↓ 1,842.0 1,842 1

Hash Right Join (cost=8,184.96..8,237.88 rows=1 width=230) (actual time=16,104.327..16,105.476 rows=1,842 loops=1)

  • Hash Cond: ((anc.chw = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
41. 1.888 34.236 ↑ 1.4 1,341 1

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

  • Group Key: anc.chw, 0
42. 1.173 32.348 ↓ 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=31.212..32.348 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
43. 31.175 31.175 ↓ 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=31.174..31.175 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))
44. 0.962 16,070.373 ↓ 1,842.0 1,842 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 469kB
45. 0.248 16,069.411 ↓ 1,842.0 1,842 1

Subquery Scan on chwlist (cost=150.13..201.52 rows=1 width=222) (actual time=16,061.755..16,069.411 rows=1,842 loops=1)

46. 0.000 16,069.163 ↓ 1,842.0 1,842 1

Nested Loop Anti Join (cost=150.13..201.51 rows=1 width=222) (actual time=16,061.753..16,069.163 rows=1,842 loops=1)

47. 0.551 16,062.260 ↓ 469.2 2,346 1

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

  • Hash Cond: ((row_number() OVER (?)) = (row_number() OVER (?)))
48. 0.012 16,039.987 ↑ 1,000.0 1 1

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

49. 0.008 16,039.975 ↑ 1,000.0 1 1

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

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

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

51. 1.207 21.722 ↓ 2,346.0 2,346 1

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

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 608kB
52. 1.826 20.515 ↓ 2,346.0 2,346 1

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

53. 2.364 16.343 ↓ 2,346.0 2,346 1

Nested Loop (cost=4.69..89.88 rows=1 width=210) (actual time=0.117..16.343 rows=2,346 loops=1)

54. 0.614 2.249 ↓ 2,346.0 2,346 1

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

55. 0.049 0.049 ↓ 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.041..0.049 rows=13 loops=1)

  • Index Cond: (type = 'district_hospital'::text)
  • Filter: ((name <> 'HQ'::text) AND (name <> 'HQ OVC'::text))
  • Rows Removed by Filter: 1
56. 1.300 1.586 ↓ 1.0 180 13

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

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

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

  • Index Cond: (branch_uuid = cmd.uuid)
58. 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)
59. 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)

60. 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
61. 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)

62. 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
63. 3.843 1,203.466 ↓ 1.4 680 1

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

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

CTE u1s

65. 1.803 8.487 ↓ 1.1 2,230 1

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

  • Group Key: useview_population_demographics.family_uuid, useview_population_demographics.uuid, useview_population_demographics.date_of_birth, 0
66. 6.684 6.684 ↓ 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.062..6.684 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
67. 1.024 1,199.623 ↑ 4.7 1,029 1

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

  • Sort Key: anc_pnc_u1fu.chw_uuid, anc_pnc_u1fu.interval_number
  • Sort Method: quicksort Memory: 193kB
68. 0.153 1,198.599 ↑ 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,187.893..1,198.599 rows=1,029 loops=1)

69. 9.904 1,198.446 ↑ 4.7 1,029 1

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

  • Group Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
70. 11.985 1,188.542 ↑ 151.2 8,776 1

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

  • Sort Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
  • Sort Method: quicksort Memory: 2716kB
71. 2.254 1,176.557 ↑ 151.2 8,776 1

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

  • Hash Cond: (pmb.baby_uuid = u1fu.patient_id)
72. 3.028 1,163.452 ↑ 62.2 8,776 1

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

  • Hash Cond: (pmb.mother_uuid = pv.patient_id)
73. 32.954 1,074.896 ↑ 54.9 2,171 1

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

  • Merge Cond: (pc.patient_id = pmb.mother_uuid)
74. 102.313 102.313 ↑ 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.026..102.313 rows=135,691 loops=1)

75. 1.808 939.629 ↑ 22.3 2,171 1

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

  • Sort Key: pmb.mother_uuid
  • Sort Method: quicksort Memory: 322kB
76. 0.130 937.821 ↑ 47.0 1,029 1

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

77. 2.456 937.691 ↑ 47.0 1,029 1

HashAggregate (cost=73,123.36..73,606.48 rows=48,312 width=176) (actual time=937.159..937.691 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
78. 1.673 935.235 ↑ 22.3 2,171 1

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

  • Merge Cond: (u1s.family_uuid = pd.family_uuid)
79. 3.634 12.965 ↓ 1.1 2,230 1

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

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

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

81. 0.941 920.597 ↑ 2.2 2,171 1

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

82. 0.416 919.656 ↑ 2.5 1,978 1

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

83. 6.224 905.450 ↓ 1.0 1,970 1

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

  • Group Key: pd.family_uuid
84. 5.033 899.226 ↓ 1.8 3,467 1

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

  • Sort Key: pd.family_uuid
  • Sort Method: quicksort Memory: 584kB
85. 1.648 894.193 ↓ 1.8 3,467 1

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

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

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

87. 125.184 892.233 ↓ 1.8 314,069 1

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

  • Buckets: 524288 (originally 262144) Batches: 1 (originally 1) Memory Usage: 36608kB
88. 767.049 767.049 ↓ 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.078..767.049 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
89. 13.790 13.790 ↑ 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.007 rows=1 loops=1,970)

  • Index Cond: (patient_id = (string_agg(DISTINCT pd.uuid, ','::text)))
90. 48.290 85.528 ↓ 1.0 177,936 1

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

  • Buckets: 262144 Batches: 1 Memory Usage: 20464kB
91. 37.238 37.238 ↓ 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..37.238 rows=177,936 loops=1)

92. 5.682 10.851 ↑ 1.0 17,710 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 2090kB
93. 5.169 5.169 ↑ 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.011..5.169 rows=17,710 loops=1)

94. 523.128 952.314 ↑ 2.8 429 1,842

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

  • Group Key: contactview_metadata.parent_uuid, 0
95. 186.872 429.186 ↑ 1.6 743 1,842

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

  • Sort Key: contactview_metadata.parent_uuid
  • Sort Method: quicksort Memory: 144kB
96. 242.314 242.314 ↑ 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.158..242.314 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
97. 319.467 320.508 ↑ 1.6 668 1,842

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

  • Group Key: useview_pregnancy.chw, 0
98. 1.041 1.041 ↑ 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.024..1.041 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))
99. 564.533 569.178 ↑ 1.9 693 1,842

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

  • Group Key: pnc_1.chw, 0
100. 4.645 4.645 ↑ 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.645 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
101. 126.101 582.072 ↓ 1.6 324 1,842

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

  • Group Key: p.chw, 0
102. 0.507 455.971 ↑ 216.6 434 1

Hash Left Join (cost=32,679.51..33,305.12 rows=94,014 width=76) (actual time=440.376..455.971 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
103. 21.184 370.694 ↑ 2.0 751 1

HashAggregate (cost=24,330.38..24,936.57 rows=1,525 width=76) (actual time=355.476..370.694 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
104. 5.276 349.510 ↓ 1.3 11,506 1

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

  • Hash Cond: (p.patient_id = upv.patient_id)
105. 19.182 293.586 ↓ 1.6 18,563 1

Hash Join (cost=15,927.82..18,954.64 rows=11,364 width=78) (actual time=266.305..293.586 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
106. 8.149 8.149 ↓ 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..8.149 rows=60,660 loops=1)

107. 4.178 266.255 ↑ 1.8 16,977 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1613kB
108. 2.230 262.077 ↑ 1.8 16,977 1

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

109. 6.990 259.847 ↑ 1.8 16,977 1

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

110. 124.121 252.857 ↑ 1.1 48,688 1

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

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

Seq Scan on useview_pregnancy_visit (cost=0.00..10,826.20 rows=52,759 width=47) (actual time=47.432..128.736 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
112. 1.502 50.648 ↑ 1.6 6,783 1

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

  • Buckets: 16384 Batches: 1 Memory Usage: 586kB
113. 0.860 49.146 ↑ 1.6 6,783 1

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

114. 1.574 48.286 ↑ 1.6 6,783 1

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

115. 16.575 46.712 ↑ 1.5 8,347 1

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

  • Sort Key: useview_pregnancy_visit_1.patient_id, useview_pregnancy_visit_1.reported DESC
  • Sort Method: quicksort Memory: 1036kB
116. 30.137 30.137 ↑ 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=10.882..30.137 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
117. 11.161 84.770 ↓ 1.2 43,086 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 3879kB
118. 35.018 73.609 ↓ 1.2 43,086 1

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

  • Group Key: useview_postnatal_care.patient_id
119. 38.591 38.591 ↑ 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.021..38.591 rows=48,409 loops=1)

  • Index Cond: (follow_up_count = '1'::text)
120. 1.203 80.321 ↑ 1.1 1,033 1

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

121. 3.331 79.118 ↑ 1.1 1,033 1

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

  • Group Key: assess.chw, 0
122. 6.512 75.787 ↓ 3.7 4,151 1

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

  • Sort Key: assess.chw
  • Sort Method: quicksort Memory: 776kB
123. 3.913 69.275 ↓ 3.7 4,151 1

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

124. 3.469 26.148 ↓ 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.892..26.148 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
125. 0.098 22.679 ↓ 0.0 0 1

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

126. 6.492 6.492 ↓ 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.492..6.492 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))
127. 16.089 16.089 ↓ 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=16.089..16.089 rows=175,711 loops=1)

  • Index Cond: (referral_follow_up = 'true'::text)
128. 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
129. 229.652 281.826 ↑ 3.5 506 1,842

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

  • Group Key: meta.chw, 0
130. 52.174 52.174 ↑ 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.869..52.174 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
131. 42.083 2,610.114 ↑ 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.417..1.417 rows=1 loops=1,842)

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

SubPlan (for Index Only Scan)

133. 5.139 2,149.614 ↑ 8.0 1 1,842

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

  • Join Filter: (meta_1.formname = "*VALUES*".column1)
  • Rows Removed by Join Filter: 2
134. 2,142.246 2,142.246 ↑ 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.133..1.163 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
135. 2.215 2.229 ↑ 1.5 2 2,229

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

136. 0.014 0.014 ↑ 1.0 3 1

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

137. 0.000 0.000 ↓ 0.0 0

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

138. 0.000 0.000 ↓ 0.0 0

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

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

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

140. 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))
141. 0.251 54.467 ↓ 0.0 0 251

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

142. 0.251 54.216 ↓ 0.0 0 251

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

143. 0.753 53.965 ↓ 0.0 0 251

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

  • Join Filter: (chw.parent_uuid = cmd_1.parent_uuid)
144. 1.255 6.777 ↑ 1.0 1 251

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

145. 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.012..0.012 rows=1 loops=251)

  • Index Cond: (uuid = chp.uuid)
146. 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
147. 46.435 46.435 ↓ 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.185..0.185 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
148. 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[])))
149. 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[])))
150. 0.000 0.000 ↓ 0.0 0

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

151. 0.000 0.000 ↓ 0.0 0

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

152. 0.000 0.000 ↓ 0.0 0

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

153. 0.000 0.000 ↓ 0.0 0

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

154. 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))
155. 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
156. 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)
157. 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[])))
158. 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[])))
159. 0.641 363.950 ↓ 0.0 0 251

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

160. 0.450 351.651 ↑ 113.0 1 251

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

161. 349.392 349.392 ↑ 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.363..1.392 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
162. 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
163. 0.759 11.658 ↓ 0.0 0 201

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

164. 1.407 1.407 ↓ 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.007..0.007 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))
165. 1.809 1.809 ↓ 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.009..0.009 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
166. 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))
167. 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))
168. 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))
169. 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))
170. 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))
171. 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))
172. 1.576 1.576 ↓ 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.008..0.008 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))
173. 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))
174. 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))
175. 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))
176. 0.000 0.000 ↓ 0.0 0

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

177. 0.000 0.000 ↓ 0.0 0

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

178. 0.000 0.000 ↓ 0.0 0

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

179. 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)
180. 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)
181. 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))
182. 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)
183. 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)
184. 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)
185. 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)
186. 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))
187. 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)
188. 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)
189. 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)
190. 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)
191. 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
192. 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))
193. 72,068.250 80,394.090 ↑ 1.3 1,651 1,842

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

  • Group Key: useview_households_visited.chw, 0
194. 8,280.245 8,325.840 ↑ 1.0 58,985 1,842

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

  • Sort Key: useview_households_visited.chw
  • Sort Method: quicksort Memory: 9831kB
195. 39.656 45.595 ↑ 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.048..45.595 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
196. 5.939 5.939 ↑ 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=5.939..5.939 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))
197. 1,120.294 1,125.462 ↑ 1.6 1,245 1,842

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

  • Group Key: population.chp_area_uuid, 0
198. 5.168 5.168 ↑ 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.056..5.168 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))
199. 1.468 59.742 ↑ 1.9 1,089 1

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

200. 30.756 58.274 ↑ 1.9 1,089 1

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

  • Group Key: survey.chw, 0
201. 16.751 27.518 ↑ 1.0 13,016 1

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

  • Sort Key: survey.chw
  • Sort Method: quicksort Memory: 2215kB
202. 10.767 10.767 ↑ 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.767 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))
203. 1,105.048 1,175.196 ↑ 71.4 1,123 1,842

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

  • Group Key: contactview_metadata_1.parent_uuid, 0
204. 70.148 70.148 ↑ 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.034..70.148 rows=239,512 loops=1)

  • Index Cond: (type = 'clinic'::text)
205. 167.780 2,265.660 ↑ 1.7 1,356 1,842

Materialize (cost=169,219.84..169,300.16 rows=2,295 width=48) (actual time=1.138..1.230 rows=1,356 loops=1,842)

206. 0.332 2,097.880 ↓ 1.2 2,708 1

Subquery Scan on sync (cost=169,219.84..169,288.69 rows=2,295 width=48) (actual time=2,095.962..2,097.880 rows=2,708 loops=1)

207. 1,364.848 2,097.548 ↓ 1.2 2,708 1

HashAggregate (cost=169,219.84..169,265.74 rows=2,295 width=48) (actual time=2,095.959..2,097.548 rows=2,708 loops=1)

  • Group Key: useview_chp_sync.chw_uuid, 0
208. 732.700 732.700 ↑ 1.0 5,332,505 1

Seq Scan on useview_chp_sync (cost=0.00..129,226.05 rows=5,332,505 width=48) (actual time=0.013..732.700 rows=5,332,505 loops=1)

209. 142.118 569.178 ↑ 2.0 1,110 1,842

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

210. 0.265 427.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=426.278..427.060 rows=2,222 loops=1)

211. 264.360 426.795 ↓ 1.0 2,222 1

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

  • Group Key: population_1.chp_area_uuid, 0
212. 162.435 162.435 ↑ 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..162.435 rows=977,458 loops=1)

213. 412.608 412.608 ↓ 6.6 1,312 1,842

CTE Scan on fp (cost=0.00..4.00 rows=200 width=52) (actual time=0.070..0.224 rows=1,312 loops=1,842)

214. 1.998 365.013 ↓ 8.2 1,630 1

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

215. 81.185 363.015 ↓ 8.2 1,630 1

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

  • Group Key: assess_u1fu_pnc_aggregated.chw, 0
216. 61.827 281.830 ↓ 184.3 36,861 1

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

  • Sort Key: assess_u1fu_pnc_aggregated.chw
  • Sort Method: quicksort Memory: 7444kB
217. 5.770 220.003 ↓ 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=199.977..220.003 rows=36,861 loops=1)

218. 8.825 214.233 ↓ 184.3 36,861 1

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

219. 111.222 205.408 ↓ 1.1 40,031 1

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

  • Sort Key: useview_assessment.patient_id, useview_assessment.reported DESC
  • Sort Method: quicksort Memory: 8144kB
220. 4.353 94.186 ↓ 1.1 40,031 1

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

221. 38.388 38.388 ↑ 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.049..38.388 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))
222. 2.861 2.861 ↓ 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.065..2.861 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))
223. 48.584 48.584 ↓ 3.0 5,796 1

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_1 (cost=0.45..3,085.60 rows=1,937 width=185) (actual time=0.125..48.584 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
224. 0.059 14.730 ↓ 1.2 59 1

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

225. 3.738 14.671 ↓ 1.2 59 1

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

  • Group Key: dr.chw, 0
226. 0.178 10.933 ↓ 1.8 92 1

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

  • Sort Key: dr.chw
  • Sort Method: quicksort Memory: 210kB
227. 4.944 10.755 ↓ 1.8 92 1

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

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

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

229. 0.017 0.017 ↓ 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.017..0.017 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
230. 4.825 4.825 ↑ 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.021..4.825 rows=638 loops=1)

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

Seq Scan on pat_district_hospital form_2 (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
232. 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)
233. 0.003 0.003 ↓ 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.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
234. 0.009 0.009 ↓ 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.009..0.009 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
235. 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)
236. 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
237. 0.005 0.005 ↓ 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.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
238. 0.005 0.005 ↓ 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.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
239. 0.003 0.003 ↓ 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.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
240. 0.005 0.005 ↓ 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.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
241. 0.032 0.844 ↓ 1.8 92 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
242. 0.812 0.812 ↓ 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.350..0.812 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
243. 0.003 104.925 ↑ 2.0 1 1

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

244. 0.008 104.922 ↑ 2.0 1 1

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

  • Group Key: "*SELECT* 1".chw_uuid, 0
245. 0.007 104.914 ↑ 1.0 2 1

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

  • Sort Key: "*SELECT* 1".chw_uuid
  • Sort Method: quicksort Memory: 25kB
246. 0.005 104.907 ↑ 1.0 2 1

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

247. 0.002 104.902 ↑ 1.0 2 1

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

248. 0.045 82.537 ↑ 1.0 1 1

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

  • Filter: (("*SELECT* 1".reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND ("*SELECT* 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
249. 0.014 82.492 ↓ 3.6 18 1

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

250. 0.058 82.478 ↓ 11.6 58 1

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

  • Sort Key: pv_2.patient_id
  • Sort Method: quicksort Memory: 33kB
251. 29.292 82.420 ↓ 11.6 58 1

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

  • Hash Cond: (pv_2.patient_id = (form_12.doc #>> '{fields,inputs,contact,_id}'::text[]))
252. 34.786 34.786 ↓ 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..34.786 rows=177,846 loops=1)

  • Filter: (patient_id <> ''::text)
  • Rows Removed by Filter: 90
253. 4.608 18.342 ↓ 638.0 638 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1052kB
254. 8.525 13.734 ↓ 638.0 638 1

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

  • Hash Cond: ((form_12.doc ->> '_id'::text) = dr_1.uuid)
255. 0.072 4.829 ↑ 1.0 638 1

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

256. 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)
257. 4.705 4.705 ↑ 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.013..4.705 rows=638 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
258. 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
259. 0.010 0.010 ↓ 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.010..0.010 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
260. 0.002 0.002 ↓ 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.002..0.002 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
261. 0.003 0.003 ↓ 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.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
262. 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)
263. 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
264. 0.005 0.005 ↓ 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.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
265. 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)
266. 0.002 0.002 ↓ 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.002..0.002 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
267. 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)
268. 0.171 0.380 ↑ 1.3 638 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
269. 0.209 0.209 ↑ 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.013..0.209 rows=638 loops=1)

  • Index Cond: (formname = 'death_report'::text)
270. 0.021 22.363 ↑ 1.0 1 1

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

  • Filter: (("*SELECT* 2".reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND ("*SELECT* 2".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
271. 0.011 22.342 ↓ 16.0 16 1

Unique (cost=235.66..235.66 rows=1 width=80) (actual time=22.329..22.342 rows=16 loops=1)

272. 0.045 22.331 ↓ 40.0 40 1

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

  • Sort Key: pc_1.patient_id
  • Sort Method: quicksort Memory: 30kB
273. 4.423 22.286 ↓ 40.0 40 1

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

274. 8.609 14.035 ↓ 638.0 638 1

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

  • Hash Cond: ((form_24.doc ->> '_id'::text) = dr_2.uuid)
275. 0.098 5.039 ↑ 1.0 638 1

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

276. 0.017 0.017 ↓ 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.016..0.017 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
277. 4.862 4.862 ↑ 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.862 rows=638 loops=1)

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

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 14
279. 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)
280. 0.003 0.003 ↓ 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.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
281. 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)
282. 0.015 0.015 ↓ 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.015..0.015 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
283. 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
284. 0.005 0.005 ↓ 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.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
285. 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)
286. 0.004 0.004 ↓ 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.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
287. 0.004 0.004 ↓ 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.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
288. 0.167 0.387 ↑ 1.3 638 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
289. 0.220 0.220 ↑ 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.033..0.220 rows=638 loops=1)

  • Index Cond: (formname = 'death_report'::text)
290. 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
291. 1.384 532.692 ↑ 1.1 1,638 1

Materialize (cost=39,801.92..41,315.88 rows=1,777 width=48) (actual time=341.793..532.692 rows=1,638 loops=1)

292. 153.123 531.308 ↑ 1.1 1,638 1

GroupAggregate (cost=39,801.92..41,293.67 rows=1,777 width=48) (actual time=341.790..531.308 rows=1,638 loops=1)

  • Group Key: useview_home_visit.reported_by, 0
293. 250.443 378.185 ↑ 1.0 146,223 1

Sort (cost=39,801.92..40,170.41 rows=147,398 width=77) (actual time=341.722..378.185 rows=146,223 loops=1)

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

Index Scan using useview_home_visit_reported_idx on useview_home_visit (cost=0.46..27,148.27 rows=147,398 width=77) (actual time=0.063..127.742 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))
295. 0.123 14.055 ↑ 1.9 106 1

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

296. 1.970 13.932 ↑ 1.9 106 1

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

  • Group Key: "*SELECT* 1_1".reported_by, 0
297. 1.487 11.962 ↑ 11.6 1,435 1

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

  • Sort Key: "*SELECT* 1_1".reported_by
  • Sort Method: quicksort Memory: 430kB
298. 1.205 10.475 ↑ 11.6 1,435 1

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

  • Merge Cond: ("*SELECT* 1_1".form_uuid = useview_fp_follow_up_prospective_ke.source_id)
299. 2.322 4.761 ↑ 1.0 1,435 1

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

  • Sort Key: "*SELECT* 1_1".form_uuid
  • Sort Method: quicksort Memory: 430kB
300. 0.167 2.439 ↑ 1.0 1,435 1

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

301. 0.047 1.194 ↑ 1.0 363 1

Subquery Scan on *SELECT* 1_1 (cost=0.30..103.83 rows=363 width=122) (actual time=0.053..1.194 rows=363 loops=1)

302. 0.047 1.147 ↑ 1.0 363 1

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

303. 0.037 1.100 ↑ 1.0 363 1

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

304. 0.145 0.145 ↑ 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.049..0.145 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))
305. 0.112 0.112 ↓ 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.035..0.112 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.806 0.806 ↑ 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.557..0.806 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
307. 0.137 1.078 ↑ 1.0 1,072 1

Subquery Scan on *SELECT* 2_1 (cost=0.31..298.72 rows=1,073 width=122) (actual time=0.035..1.078 rows=1,072 loops=1)

308. 0.941 0.941 ↑ 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.032..0.941 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))
309. 3.822 4.509 ↑ 1.0 2,319 1

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

  • Sort Key: useview_fp_follow_up_prospective_ke.source_id
  • Sort Method: quicksort Memory: 424kB
310. 0.234 0.687 ↓ 1.0 2,326 1

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

311. 0.177 0.177 ↑ 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.005..0.177 rows=930 loops=1)

312. 0.127 0.127 ↓ 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.006..0.127 rows=683 loops=1)

313. 0.149 0.149 ↑ 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.009..0.149 rows=713 loops=1)

Planning time : 53.956 ms
Execution time : 111,953.297 ms