explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Y179

Settings
# exclusive inclusive rows x rows loops node
1. 61.011 441,932.139 ↓ 1,842.0 1,842 1

GroupAggregate (cost=1,139,120.27..1,139,121.82 rows=1 width=650) (actual time=441,870.879..441,932.139 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: 858
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 131.150 ms, Inlining 74.410 ms, Optimization 9003.057 ms, Emission 6427.793 ms, Total 15636.409 ms
2. 15.596 441,871.128 ↓ 921.0 1,842 1

Sort (cost=1,139,120.27..1,139,120.27 rows=2 width=1,986) (actual time=441,870.770..441,871.128 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.207 441,855.532 ↓ 921.0 1,842 1

Merge Left Join (cost=1,090,704.48..1,139,120.26 rows=2 width=1,986) (actual time=22,285.529..441,855.532 rows=1,842 loops=1)

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

Merge Left Join (cost=1,087,698.94..1,135,400.19 rows=2 width=1,934) (actual time=22,273.799..441,835.722 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = useview_home_visit.reported_by)
  • Join Filter: (chwlist.interval_number = (0))
5. 3.477 441,285.565 ↓ 921.0 1,842 1

Merge Left Join (cost=1,040,221.71..1,086,404.32 rows=2 width=1,926) (actual time=21,934.033..441,285.565 rows=1,842 loops=1)

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

Merge Left Join (cost=1,032,041.12..1,078,223.62 rows=2 width=1,918) (actual time=21,829.227..441,177.289 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = dr.chw)
  • Join Filter: (chwlist.interval_number = (0))
7. 7.297 441,158.579 ↓ 921.0 1,842 1

Merge Left Join (cost=1,031,790.03..1,077,969.02 rows=2 width=1,902) (actual time=21,818.509..441,158.579 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess_u1fu_pnc_aggregated.chw)
  • Join Filter: (chwlist.interval_number = (0))
8. 8.720 440,774.207 ↓ 921.0 1,842 1

Merge Left Join (cost=1,012,790.85..1,058,949.31 rows=2 width=1,862) (actual time=21,539.818..440,774.207 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=1,008,541.10..1,054,585.83 rows=2 width=1,846) (actual time=21,414.604..440,608.586 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. 237.510 439,877.210 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=948,002.58..993,921.91 rows=2 width=1,874) (actual time=21,017.077..439,877.210 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. 261.193 437,381.408 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=778,782.15..824,546.56 rows=2 width=1,866) (actual time=18,927.081..437,381.408 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: 2065516
12. 11.659 383,064.883 ↓ 1,842.0 1,842 1

Merge Left Join (cost=739,267.30..779,759.55 rows=1 width=1,822) (actual time=18,479.474..383,064.883 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = survey.chw)
  • Join Filter: (chwlist.interval_number = (0))
13. 279.946 382,973.566 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=730,780.81..770,914.28 rows=1 width=1,798) (actual time=18,454.093..382,973.566 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. 362.641 90,786.354 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=730,780.23..734,961.26 rows=1 width=1,686) (actual time=18,404.476..90,786.354 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. 15.432 23,765.417 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=694,477.07..697,965.94 rows=1 width=1,678) (actual time=18,265.445..23,765.417 rows=1,842 loops=1)

  • Join Filter: (chwlist.interval_number = 0)
16. 88.346 21,136.187 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=694,476.79..694,954.24 rows=1 width=1,674) (actual time=18,264.609..21,136.187 rows=1,842 loops=1)

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

Merge Left Join (cost=690,283.37..690,699.25 rows=1 width=1,666) (actual time=18,212.301..20,773.383 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess.chw)
  • Join Filter: (chwlist.interval_number = (0))
18. 57.234 20,671.238 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=671,608.68..671,985.14 rows=1 width=1,658) (actual time=18,123.222..20,671.238 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=631,472.40..631,841.86 rows=1 width=1,650) (actual time=17,492.552..19,855.100 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = anc.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 1585909
20. 115.806 19,303.655 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=623,488.99..623,791.11 rows=1 width=1,642) (actual time=17,460.612..19,303.655 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=621,684.27..621,940.44 rows=1 width=1,546) (actual time=17,451.894..18,633.407 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=621,288.04..621,506.68 rows=1 width=1,530) (actual time=17,449.882..18,219.279 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
23. 9.510 17,208.922 ↓ 1,842.0 1,842 1

Merge Left Join (cost=603,696.32..603,861.69 rows=1 width=1,522) (actual time=17,194.164..17,208.922 rows=1,842 loops=1)

  • Merge Cond: ((chwlist.chw_uuid = anc_pnc_u1fu.chw_uuid) AND (chwlist.interval_number = anc_pnc_u1fu.interval_number))
24. 6.797 15,658.459 ↓ 1,842.0 1,842 1

Sort (cost=30,546.15..30,546.16 rows=1 width=1,474) (actual time=15,657.460..15,658.459 rows=1,842 loops=1)

  • Sort Key: chwlist.chw_uuid, chwlist.interval_number
  • Sort Method: quicksort Memory: 935kB
25. 1.151 15,651.662 ↓ 1,842.0 1,842 1

Hash Right Join (cost=26,453.67..30,546.14 rows=1 width=1,474) (actual time=15,610.880..15,651.662 rows=1,842 loops=1)

  • Hash Cond: ((chwview_assessment.chw_uuid = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
26. 27.253 88.359 ↑ 1.3 1,624 1

GroupAggregate (cost=26,251.94..30,286.51 rows=2,105 width=1,292) (actual time=48.712..88.359 rows=1,624 loops=1)

  • Group Key: chwview_assessment.chw_uuid, 0
27. 32.997 61.106 ↑ 1.1 33,495 1

Sort (cost=26,251.94..26,340.26 rows=35,328 width=352) (actual time=48.656..61.106 rows=33,495 loops=1)

  • Sort Key: chwview_assessment.chw_uuid
  • Sort Method: external merge Disk: 3776kB
28. 20.709 28.109 ↑ 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.716..28.109 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
29. 7.400 7.400 ↑ 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.399..7.400 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))
30. 0.911 15,562.152 ↓ 1,842.0 1,842 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 469kB
31. 0.239 15,561.241 ↓ 1,842.0 1,842 1

Subquery Scan on chwlist (cost=191.48..201.72 rows=1 width=222) (actual time=15,553.223..15,561.241 rows=1,842 loops=1)

32. 1.892 15,561.002 ↓ 1,842.0 1,842 1

Nested Loop Anti Join (cost=191.48..201.71 rows=1 width=222) (actual time=15,553.221..15,561.002 rows=1,842 loops=1)

33. 0.979 15,554.418 ↓ 469.2 2,346 1

Group (cost=191.21..191.35 rows=5 width=222) (actual time=15,553.198..15,554.418 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)
34. 7.824 15,553.439 ↓ 469.2 2,346 1

Sort (cost=191.21..191.22 rows=5 width=222) (actual time=15,553.182..15,553.439 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
35. 0.329 15,545.615 ↓ 469.2 2,346 1

Hash Join (cost=149.85..191.15 rows=5 width=222) (actual time=15,545.307..15,545.615 rows=2,346 loops=1)

  • Hash Cond: ((row_number() OVER (?)) = (row_number() OVER (?)))
36. 0.007 15,516.999 ↑ 1,000.0 1 1

WindowAgg (cost=59.85..87.35 rows=1,000 width=24) (actual time=15,516.999..15,516.999 rows=1 loops=1)

37. 0.005 15,516.992 ↑ 1,000.0 1 1

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

  • Sort Key: generate_series.generate_series
  • Sort Method: quicksort Memory: 25kB
38. 15,516.987 15,516.987 ↑ 1,000.0 1 1

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

39. 1.260 28.287 ↓ 2,346.0 2,346 1

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

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 608kB
40. 0.284 27.027 ↓ 2,346.0 2,346 1

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

41. 2.336 22.051 ↓ 2,346.0 2,346 1

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

42. 0.586 5.639 ↓ 2,346.0 2,346 1

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

43. 0.516 0.516 ↓ 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.507..0.516 rows=13 loops=1)

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

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

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

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

  • Index Cond: (branch_uuid = cmd.uuid)
46. 14.076 14.076 ↑ 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.006..0.006 rows=1 loops=2,346)

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

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

48. 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
49. 0.014 0.014 ↑ 1.0 1 1

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

50. 4.692 4.692 ↓ 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.002..0.002 rows=0 loops=2,346)

  • Index Cond: (chw = chp_1.uuid)
  • Heap Fetches: 504
51. 3.742 1,540.953 ↓ 1.4 680 1

GroupAggregate (cost=573,150.17..573,308.49 rows=469 width=88) (actual time=1,536.677..1,540.953 rows=680 loops=1)

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

CTE u1s

53. 0.563 144.923 ↓ 1.1 2,230 1

Group (cost=33,923.70..33,948.23 rows=1,962 width=82) (actual time=144.226..144.923 rows=2,230 loops=1)

  • Group Key: useview_population_demographics.family_uuid, useview_population_demographics.uuid, useview_population_demographics.date_of_birth, 0
54. 4.206 144.360 ↓ 1.1 2,230 1

Sort (cost=33,923.70..33,928.61 rows=1,962 width=82) (actual time=144.188..144.360 rows=2,230 loops=1)

  • Sort Key: useview_population_demographics.family_uuid, useview_population_demographics.uuid, useview_population_demographics.date_of_birth
  • Sort Method: quicksort Memory: 410kB
55. 140.154 140.154 ↓ 1.1 2,230 1

Index Scan using useview_population_demographics_chp_area_reported on useview_population_demographics (cost=0.58..33,816.40 rows=1,962 width=82) (actual time=0.090..140.154 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
56. 0.915 1,537.211 ↑ 4.6 1,029 1

Sort (cost=539,201.94..539,213.67 rows=4,691 width=64) (actual time=1,536.663..1,537.211 rows=1,029 loops=1)

  • Sort Key: anc_pnc_u1fu.chw_uuid, anc_pnc_u1fu.interval_number
  • Sort Method: quicksort Memory: 193kB
57. 0.147 1,536.296 ↑ 4.6 1,029 1

Subquery Scan on anc_pnc_u1fu (cost=516,274.60..538,915.89 rows=4,691 width=64) (actual time=1,524.377..1,536.296 rows=1,029 loops=1)

58. 9.495 1,536.149 ↑ 4.6 1,029 1

GroupAggregate (cost=516,274.60..538,868.98 rows=4,691 width=100) (actual time=1,524.374..1,536.149 rows=1,029 loops=1)

  • Group Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
59. 14.890 1,526.654 ↑ 146.8 8,776 1

Sort (cost=516,274.60..519,495.66 rows=1,288,427 width=183) (actual time=1,524.327..1,526.654 rows=8,776 loops=1)

  • Sort Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
  • Sort Method: external merge Disk: 1408kB
60. 33.297 1,511.764 ↑ 146.8 8,776 1

Merge Right Join (cost=146,306.64..184,326.33 rows=1,288,427 width=183) (actual time=1,193.802..1,511.764 rows=8,776 loops=1)

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

62. 2.248 1,373.520 ↑ 59.5 8,776 1

Materialize (cost=146,306.22..156,464.43 rows=522,451 width=182) (actual time=1,193.418..1,373.520 rows=8,776 loops=1)

63. 36.983 1,371.272 ↑ 138.2 3,781 1

Merge Left Join (cost=146,306.22..155,158.30 rows=522,451 width=182) (actual time=1,193.414..1,371.272 rows=3,781 loops=1)

  • Merge Cond: (pmb.mother_uuid = pv.patient_id)
64. 1.654 743.776 ↑ 110.9 1,029 1

Sort (cost=115,150.72..115,435.98 rows=114,104 width=145) (actual time=743.531..743.776 rows=1,029 loops=1)

  • Sort Key: pmb.mother_uuid
  • Sort Method: quicksort Memory: 322kB
65. 2.010 742.122 ↑ 110.9 1,029 1

Hash Left Join (cost=90,770.95..95,512.79 rows=114,104 width=145) (actual time=738.990..742.122 rows=1,029 loops=1)

  • Hash Cond: (pmb.baby_uuid = u1fu.patient_id)
66. 0.129 729.308 ↑ 45.6 1,029 1

Subquery Scan on pmb (cost=89,326.47..90,616.53 rows=46,911 width=108) (actual time=728.091..729.308 rows=1,029 loops=1)

67. 0.770 729.179 ↑ 45.6 1,029 1

Group (cost=89,326.47..90,147.42 rows=46,911 width=176) (actual time=728.089..729.179 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
68. 4.128 728.409 ↑ 21.6 2,171 1

Sort (cost=89,326.47..89,443.75 rows=46,911 width=172) (actual time=728.079..728.409 rows=2,171 loops=1)

  • Sort Key: pnc.chw, u1s.family_uuid, (string_agg(DISTINCT pd.uuid, ','::text)), u1s.uuid, u1s.interval_number
  • Sort Method: quicksort Memory: 673kB
69. 1.583 724.281 ↑ 21.6 2,171 1

Merge Join (cost=77,378.72..83,337.43 rows=46,911 width=172) (actual time=702.656..724.281 rows=2,171 loops=1)

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

Sort (cost=146.54..151.45 rows=1,962 width=68) (actual time=146.359..146.598 rows=2,230 loops=1)

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

CTE Scan on u1s (cost=0.00..39.24 rows=1,962 width=68) (actual time=144.230..145.719 rows=2,230 loops=1)

72. 0.886 576.100 ↑ 2.2 2,171 1

Materialize (cost=77,232.18..82,489.37 rows=4,782 width=141) (actual time=556.286..576.100 rows=2,171 loops=1)

73. 1.655 575.214 ↑ 2.4 1,978 1

Nested Loop (cost=77,232.18..82,477.42 rows=4,782 width=141) (actual time=556.283..575.214 rows=1,978 loops=1)

74. 5.182 561.739 ↓ 1.0 1,970 1

GroupAggregate (cost=77,231.76..77,270.54 rows=1,939 width=69) (actual time=556.241..561.739 rows=1,970 loops=1)

  • Group Key: pd.family_uuid
75. 5.034 556.557 ↓ 1.8 3,467 1

Sort (cost=77,231.76..77,236.61 rows=1,939 width=74) (actual time=556.195..556.557 rows=3,467 loops=1)

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

Hash Join (cost=74,774.08..77,125.88 rows=1,939 width=74) (actual time=474.006..551.523 rows=3,467 loops=1)

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

CTE Scan on u1s u1s_1 (cost=0.00..39.24 rows=1,962 width=32) (actual time=0.002..0.294 rows=2,230 loops=1)

78. 111.335 473.808 ↓ 1.8 314,069 1

Hash (cost=70,313.10..70,313.10 rows=177,039 width=74) (actual time=473.808..473.808 rows=314,069 loops=1)

  • Buckets: 32768 (originally 32768) Batches: 32 (originally 16) Memory Usage: 1842kB
79. 362.473 362.473 ↓ 1.8 314,069 1

Seq Scan on useview_population_demographics pd (cost=0.00..70,313.10 rows=177,039 width=74) (actual time=0.016..362.473 rows=314,069 loops=1)

  • Filter: ((sex = 'female'::text) AND ((date_part('years'::text, age(now(), (date_of_birth)::timestamp with time zone)))::integer >= 15))
  • Rows Removed by Filter: 663389
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.66 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. 5.291 10.804 ↑ 1.0 17,710 1

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

  • Buckets: 32768 Batches: 2 Memory Usage: 1198kB
82. 5.513 5.513 ↑ 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.021..5.513 rows=17,710 loops=1)

83. 33.210 590.513 ↓ 1.0 178,083 1

Materialize (cost=31,155.50..32,045.10 rows=177,920 width=73) (actual time=449.610..590.513 rows=178,083 loops=1)

84. 521.225 557.303 ↑ 1.0 177,852 1

Sort (cost=31,155.50..31,600.30 rows=177,920 width=73) (actual time=449.607..557.303 rows=177,852 loops=1)

  • Sort Key: pv.patient_id
  • Sort Method: external merge Disk: 14656kB
85. 36.078 36.078 ↓ 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.009..36.078 rows=177,936 loops=1)

86. 501.024 933.894 ↑ 2.8 429 1,842

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

  • Group Key: contactview_metadata.parent_uuid, 0
87. 178.270 432.870 ↑ 1.6 743 1,842

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

  • Sort Key: contactview_metadata.parent_uuid
  • Sort Method: quicksort Memory: 144kB
88. 254.600 254.600 ↑ 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.159..254.600 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
89. 302.812 303.930 ↑ 1.6 668 1,842

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

  • Group Key: useview_pregnancy.chw, 0
90. 1.118 1.118 ↑ 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.036..1.118 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))
91. 549.924 554.442 ↑ 1.9 693 1,842

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

  • Group Key: pnc_1.chw, 0
92. 4.518 4.518 ↑ 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.071..4.518 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
93. 380.832 410.766 ↑ 2.2 862 1,842

HashAggregate (cost=7,983.42..8,002.66 rows=1,924 width=48) (actual time=0.018..0.223 rows=862 loops=1,842)

  • Group Key: anc.chw, 0
94. 1.172 29.934 ↓ 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=28.803..29.934 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
95. 28.762 28.762 ↓ 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=28.762..28.762 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))
96. 128.575 758.904 ↓ 1.6 324 1,842

HashAggregate (cost=40,136.27..40,138.27 rows=200 width=48) (actual time=0.343..0.412 rows=324 loops=1,842)

  • Group Key: p.chw, 0
97. 3.098 630.329 ↑ 216.6 434 1

Hash Left Join (cost=38,237.68..39,431.17 rows=94,014 width=76) (actual time=605.421..630.329 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(useview_pregnancy_visit.new_edd) <> ''::text) THEN (max(useview_pregnancy_visit.new_edd))::date ELSE max(p.edd) END) - ((max(useview_postnatal_care.reported)))::date)) > 60))
  • Rows Removed by Filter: 317
98. 20.344 456.325 ↑ 2.0 751 1

GroupAggregate (cost=26,640.55..27,452.61 rows=1,525 width=76) (actual time=434.466..456.325 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
99. 26.348 435.981 ↓ 1.3 11,506 1

Sort (cost=26,640.55..26,663.42 rows=9,150 width=78) (actual time=434.404..435.981 rows=11,506 loops=1)

  • Sort Key: p.chw, p.patient_id
  • Sort Method: quicksort Memory: 1918kB
100. 8.399 409.633 ↓ 1.3 11,506 1

Merge Anti Join (cost=20,681.43..26,038.50 rows=9,150 width=78) (actual time=284.423..409.633 rows=11,506 loops=1)

  • Merge Cond: (p.patient_id = useview_pregnancy_visit_1.patient_id)
101. 29.710 349.416 ↓ 1.6 18,563 1

Merge Join (cost=15,916.00..21,026.83 rows=11,364 width=78) (actual time=236.401..349.416 rows=18,563 loops=1)

  • Merge Cond: (useview_pregnancy_visit.patient_id = p.patient_id)
  • Join Filter: (p.reported < useview_pregnancy_visit.reported)
  • Rows Removed by Join Filter: 47
102. 8.069 271.132 ↑ 1.8 16,977 1

Unique (cost=15,915.59..16,179.38 rows=31,095 width=47) (actual time=236.328..271.132 rows=16,977 loops=1)

103. 134.519 263.063 ↑ 1.1 48,688 1

Sort (cost=15,915.59..16,047.48 rows=52,759 width=47) (actual time=236.326..263.063 rows=48,688 loops=1)

  • Sort Key: useview_pregnancy_visit.patient_id, useview_pregnancy_visit.reported DESC
  • Sort Method: external merge Disk: 2944kB
104. 128.544 128.544 ↑ 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.654..128.544 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
105. 48.574 48.574 ↓ 1.0 60,660 1

Index Scan using useview_pregnancy_patient_id on useview_pregnancy p (cost=0.41..3,880.96 rows=60,659 width=84) (actual time=0.030..48.574 rows=60,660 loops=1)

106. 2.022 51.818 ↑ 1.6 6,783 1

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

107. 17.905 49.796 ↑ 1.5 8,347 1

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

  • Sort Key: useview_pregnancy_visit_1.patient_id, useview_pregnancy_visit_1.reported DESC
  • Sort Method: quicksort Memory: 1036kB
108. 31.891 31.891 ↑ 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=11.244..31.891 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
109. 15.280 170.906 ↓ 1.2 43,086 1

Hash (cost=10,817.34..10,817.34 rows=36,623 width=44) (actual time=170.906..170.906 rows=43,086 loops=1)

  • Buckets: 32768 Batches: 2 Memory Usage: 1946kB
110. 24.737 155.626 ↓ 1.2 43,086 1

GroupAggregate (cost=0.42..10,451.11 rows=36,623 width=44) (actual time=0.192..155.626 rows=43,086 loops=1)

  • Group Key: useview_postnatal_care.patient_id
111. 130.889 130.889 ↑ 1.0 48,409 1

Index Scan using useview_postnatal_patient_id on useview_postnatal_care (cost=0.42..9,841.60 rows=48,656 width=44) (actual time=0.018..130.889 rows=48,409 loops=1)

  • Filter: (follow_up_count = '1'::text)
  • Rows Removed by Filter: 87359
112. 1.350 95.000 ↑ 1.1 1,033 1

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

113. 3.175 93.650 ↑ 1.1 1,033 1

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

  • Group Key: assess.chw, 0
114. 6.579 90.475 ↓ 3.7 4,151 1

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

  • Sort Key: assess.chw
  • Sort Method: quicksort Memory: 776kB
115. 3.908 83.896 ↓ 3.7 4,151 1

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

116. 4.073 29.570 ↓ 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=25.710..29.570 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
117. 0.120 25.497 ↓ 0.0 0 1

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

118. 8.151 8.151 ↓ 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=8.151..8.151 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))
119. 17.226 17.226 ↓ 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=17.226..17.226 rows=175,711 loops=1)

  • Index Cond: (referral_follow_up = 'true'::text)
120. 50.418 50.418 ↑ 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.009..0.009 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
121. 222.895 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
122. 51.563 51.563 ↑ 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.590..51.563 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
123. 36.403 2,613.798 ↑ 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.419..1.419 rows=1 loops=1,842)

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

SubPlan (for Index Only Scan)

125. 5.139 2,140.404 ↑ 8.0 1 1,842

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

  • Join Filter: (meta_1.formname = "*VALUES*".column1)
  • Rows Removed by Join Filter: 2
126. 2,133.036 2,133.036 ↑ 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.128..1.158 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
127. 2.224 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)

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

129. 0.000 0.000 ↓ 0.0 0

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

130. 0.000 0.000 ↓ 0.0 0

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

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

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

132. 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))
133. 0.251 53.965 ↓ 0.0 0 251

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

134. 0.251 53.714 ↓ 0.0 0 251

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

135. 0.502 53.463 ↓ 0.0 0 251

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

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

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

137. 3.263 3.263 ↑ 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.013 rows=1 loops=251)

  • Index Cond: (uuid = chp.uuid)
138. 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
139. 45.933 45.933 ↓ 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.183..0.183 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
140. 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[])))
141. 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[])))
142. 0.579 383.026 ↓ 0.0 0 251

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

143. 0.497 358.930 ↑ 113.0 1 251

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

144. 353.408 353.408 ↑ 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.378..1.408 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
145. 5.025 5.025 ↑ 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.025..0.025 rows=1 loops=201)

  • Index Cond: (uuid = meta_3.uuid)
  • Heap Fetches: 0
146. 0.802 23.517 ↓ 0.0 0 201

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

147. 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))
148. 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
149. 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))
150. 5.910 5.910 ↓ 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.030..0.030 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))
151. 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))
152. 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))
153. 8.668 8.668 ↓ 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.044..0.044 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))
154. 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))
155. 1.773 1.773 ↓ 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.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))
156. 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))
157. 0.394 0.394 ↓ 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.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))
158. 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))
159. 0.000 0.000 ↓ 0.0 0

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

160. 0.000 0.000 ↓ 0.0 0

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

161. 0.000 0.000 ↓ 0.0 0

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

162. 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)
163. 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)
164. 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))
165. 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)
166. 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)
167. 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)
168. 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)
169. 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))
170. 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)
171. 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)
172. 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)
173. 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)
174. 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
175. 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))
176. 48,785.370 66,658.296 ↑ 1.3 1,651 1,842

GroupAggregate (cost=36,303.16..36,922.35 rows=2,085 width=48) (actual time=0.088..36.188 rows=1,651 loops=1,842)

  • Group Key: useview_households_visited.chw, 0
177. 17,778.673 17,872.926 ↑ 1.0 58,985 1,842

Sort (cost=36,303.16..36,452.74 rows=59,834 width=76) (actual time=0.076..9.703 rows=58,985 loops=1,842)

  • Sort Key: useview_households_visited.chw
  • Sort Method: external sort Disk: 5512kB
178. 85.528 94.253 ↑ 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=11.824..94.253 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
179. 8.725 8.725 ↑ 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=8.725..8.725 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))
180. 38,381.754 291,907.266 ↑ 1.6 1,245 1,842

GroupAggregate (cost=0.58..35,881.79 rows=2,035 width=152) (actual time=0.274..158.473 rows=1,245 loops=1,842)

  • Group Key: population.chp_area_uuid, 0
181. 253,525.512 253,525.512 ↑ 1.1 5,131 1,842

Index Scan using useview_population_demographics_chp_area_reported on useview_population_demographics population (cost=0.58..33,728.12 rows=5,885 width=87) (actual time=0.071..137.636 rows=5,131 loops=1,842)

  • 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))
182. 1.640 79.658 ↑ 1.9 1,089 1

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

183. 46.246 78.018 ↑ 1.9 1,089 1

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

  • Group Key: survey.chw, 0
184. 21.659 31.772 ↑ 1.0 13,016 1

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

  • Sort Key: survey.chw
  • Sort Method: external merge Disk: 1344kB
185. 10.113 10.113 ↑ 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.113 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))
186. 26,023.776 54,055.332 ↑ 71.4 1,122 1,842

GroupAggregate (cost=39,514.85..42,783.54 rows=80,139 width=48) (actual time=0.255..29.346 rows=1,122 loops=1,842)

  • Group Key: contactview_metadata_1.parent_uuid, 0
187. 27,964.453 28,031.556 ↑ 2.1 120,165 1,842

Sort (cost=39,514.85..40,131.67 rows=246,730 width=40) (actual time=0.234..15.218 rows=120,165 loops=1,842)

  • Sort Key: contactview_metadata_1.parent_uuid
  • Sort Method: external sort Disk: 13624kB
188. 67.103 67.103 ↑ 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..67.103 rows=239,512 loops=1)

  • Index Cond: (type = 'clinic'::text)
189. 169.241 2,258.292 ↑ 1.7 1,356 1,842

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

190. 0.386 2,089.051 ↓ 1.2 2,708 1

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

191. 1,341.406 2,088.665 ↓ 1.2 2,708 1

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

  • Group Key: useview_chp_sync.chw_uuid, 0
192. 747.259 747.259 ↑ 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.013..747.259 rows=5,332,505 loops=1)

193. 138.350 536.022 ↑ 2.0 1,110 1,842

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

194. 0.273 397.672 ↓ 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=396.895..397.672 rows=2,222 loops=1)

195. 241.819 397.399 ↓ 1.0 2,222 1

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

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

197. 1.555 156.901 ↓ 6.6 1,312 1

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

198. 27.721 155.346 ↓ 6.6 1,312 1

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

  • Group Key: "*SELECT* 1".reported_by, 0
199. 11.024 127.625 ↑ 1.0 6,137 1

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

  • Sort Key: "*SELECT* 1".reported_by
  • Sort Method: quicksort Memory: 1056kB
200. 1.017 116.601 ↑ 1.0 6,137 1

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

201. 0.858 115.584 ↑ 1.0 6,137 1

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

202. 0.012 5.297 ↓ 1.0 46 1

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

203. 5.285 5.285 ↓ 1.0 46 1

Seq Scan on useview_fp_registration (cost=0.00..349.86 rows=44 width=256) (actual time=1.769..5.285 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
204. 0.061 4.599 ↑ 1.0 294 1

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

205. 4.538 4.538 ↑ 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.060..4.538 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
206. 1.134 104.830 ↑ 1.0 5,797 1

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

207. 103.696 103.696 ↑ 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.111..103.696 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))
208. 1.840 377.075 ↓ 8.2 1,630 1

Materialize (cost=18,999.19..19,019.19 rows=200 width=80) (actual time=278.680..377.075 rows=1,630 loops=1)

209. 78.656 375.235 ↓ 8.2 1,630 1

GroupAggregate (cost=18,999.19..19,016.69 rows=200 width=80) (actual time=278.677..375.235 rows=1,630 loops=1)

  • Group Key: assess_u1fu_pnc_aggregated.chw, 0
210. 72.080 296.579 ↓ 184.3 36,861 1

Sort (cost=18,999.19..18,999.69 rows=200 width=96) (actual time=278.654..296.579 rows=36,861 loops=1)

  • Sort Key: assess_u1fu_pnc_aggregated.chw
  • Sort Method: external merge Disk: 3984kB
211. 5.915 224.499 ↓ 184.3 36,861 1

Subquery Scan on assess_u1fu_pnc_aggregated (cost=18,800.76..18,991.54 rows=200 width=96) (actual time=184.792..224.499 rows=36,861 loops=1)

212. 8.823 218.584 ↓ 184.3 36,861 1

Unique (cost=18,800.76..18,989.54 rows=200 width=100) (actual time=184.780..218.584 rows=36,861 loops=1)

213. 117.458 209.761 ↓ 1.1 40,031 1

Sort (cost=18,800.76..18,895.15 rows=37,756 width=100) (actual time=184.779..209.761 rows=40,031 loops=1)

  • Sort Key: useview_assessment.patient_id, useview_assessment.reported DESC
  • Sort Method: external merge Disk: 4512kB
214. 4.332 92.303 ↓ 1.1 40,031 1

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

215. 38.503 38.503 ↑ 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.038..38.503 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))
216. 2.898 2.898 ↓ 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.087..2.898 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))
217. 46.570 46.570 ↓ 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.156..46.570 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
218. 0.052 14.131 ↓ 1.2 59 1

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

219. 3.354 14.079 ↓ 1.2 59 1

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

  • Group Key: dr.chw, 0
220. 0.163 10.725 ↓ 1.8 92 1

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

  • Sort Key: dr.chw
  • Sort Method: quicksort Memory: 210kB
221. 4.873 10.562 ↓ 1.8 92 1

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

  • Hash Cond: ((form.doc ->> '_id'::text) = dr.uuid)
222. 0.067 4.909 ↑ 1.0 638 1

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

223. 0.012 0.012 ↓ 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.012..0.012 rows=0 loops=1)

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

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

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 14
226. 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)
227. 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)
228. 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)
229. 0.006 0.006 ↓ 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.006..0.006 rows=0 loops=1)

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

Seq Scan on pat_meta form_7 (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
231. 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)
232. 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)
233. 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)
234. 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)
235. 0.029 0.780 ↓ 1.8 92 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
236. 0.751 0.751 ↓ 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.316..0.751 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
237. 0.003 104.799 ↑ 2.0 1 1

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

238. 0.008 104.796 ↑ 2.0 1 1

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

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

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

  • Sort Key: "*SELECT* 1_1".chw_uuid
  • Sort Method: quicksort Memory: 25kB
240. 0.003 104.781 ↑ 1.0 2 1

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

241. 0.001 104.778 ↑ 1.0 2 1

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

242. 0.035 82.626 ↑ 1.0 1 1

Subquery Scan on *SELECT* 1_1 (cost=7,944.61..7,944.84 rows=1 width=36) (actual time=82.615..82.626 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
243. 0.014 82.591 ↓ 3.6 18 1

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

244. 0.052 82.577 ↓ 11.6 58 1

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

  • Sort Key: pv_1.patient_id
  • Sort Method: quicksort Memory: 33kB
245. 28.097 82.525 ↓ 11.6 58 1

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

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

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

  • Filter: (patient_id <> ''::text)
  • Rows Removed by Filter: 90
247. 4.649 18.404 ↓ 638.0 638 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1052kB
248. 8.511 13.755 ↓ 638.0 638 1

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

  • Hash Cond: ((form_12.doc ->> '_id'::text) = dr_1.uuid)
249. 0.068 4.891 ↑ 1.0 638 1

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

250. 0.004 0.004 ↓ 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.004..0.004 rows=0 loops=1)

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

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

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

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

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

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
256. 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)
257. 0.013 0.013 ↓ 0.0 0 1

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 1
258. 0.004 0.004 ↓ 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.004..0.004 rows=0 loops=1)

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
262. 0.161 0.353 ↑ 1.3 638 1

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

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

  • Index Cond: (formname = 'death_report'::text)
264. 0.022 22.151 ↑ 1.0 1 1

Subquery Scan on *SELECT* 2_1 (cost=235.66..235.71 rows=1 width=36) (actual time=22.144..22.151 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
265. 0.009 22.129 ↓ 16.0 16 1

Unique (cost=235.66..235.66 rows=1 width=80) (actual time=22.118..22.129 rows=16 loops=1)

266. 0.042 22.120 ↓ 40.0 40 1

Sort (cost=235.66..235.66 rows=1 width=80) (actual time=22.117..22.120 rows=40 loops=1)

  • Sort Key: pc_1.patient_id
  • Sort Method: quicksort Memory: 30kB
267. 4.449 22.078 ↓ 40.0 40 1

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

268. 8.484 13.801 ↓ 638.0 638 1

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

  • Hash Cond: ((form_24.doc ->> '_id'::text) = dr_2.uuid)
269. 0.075 4.937 ↑ 1.0 638 1

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

270. 0.011 0.011 ↓ 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.011..0.011 rows=0 loops=1)

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

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

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

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

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
275. 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)
276. 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)
277. 0.006 0.006 ↓ 0.0 0 1

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
  • Rows Removed by Filter: 1
278. 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)
279. 0.003 0.003 ↓ 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.003..0.003 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_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)
281. 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)
282. 0.165 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
283. 0.215 0.215 ↑ 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.215 rows=638 loops=1)

  • Index Cond: (formname = 'death_report'::text)
284. 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
285. 1.480 543.787 ↑ 1.1 1,638 1

Materialize (cost=47,477.23..48,991.20 rows=1,777 width=48) (actual time=339.756..543.787 rows=1,638 loops=1)

286. 155.550 542.307 ↑ 1.1 1,638 1

GroupAggregate (cost=47,477.23..48,968.99 rows=1,777 width=48) (actual time=339.753..542.307 rows=1,638 loops=1)

  • Group Key: useview_home_visit.reported_by, 0
287. 253.220 386.757 ↑ 1.0 146,223 1

Sort (cost=47,477.23..47,845.73 rows=147,399 width=77) (actual time=339.684..386.757 rows=146,223 loops=1)

  • Sort Key: useview_home_visit.reported_by
  • Sort Method: external merge Disk: 13056kB
288. 133.537 133.537 ↑ 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.594..133.537 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))
289. 0.118 13.603 ↑ 1.9 106 1

Materialize (cost=3,005.54..3,719.53 rows=200 width=97) (actual time=11.722..13.603 rows=106 loops=1)

290. 1.411 13.485 ↑ 1.9 106 1

GroupAggregate (cost=3,005.54..3,717.03 rows=200 width=97) (actual time=11.718..13.485 rows=106 loops=1)

  • Group Key: "*SELECT* 1_2".reported_by, 0
291. 1.452 12.074 ↑ 11.6 1,435 1

Sort (cost=3,005.54..3,047.27 rows=16,694 width=178) (actual time=11.693..12.074 rows=1,435 loops=1)

  • Sort Key: "*SELECT* 1_2".reported_by
  • Sort Method: quicksort Memory: 430kB
292. 1.167 10.622 ↑ 11.6 1,435 1

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

  • Merge Cond: ("*SELECT* 1_2".form_uuid = useview_fp_follow_up_prospective_ke.source_id)
293. 2.303 4.735 ↑ 1.0 1,435 1

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

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

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

295. 0.046 1.144 ↑ 1.0 363 1

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

296. 0.048 1.098 ↑ 1.0 363 1

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

297. 0.035 1.050 ↑ 1.0 363 1

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

298. 0.149 0.149 ↑ 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.063..0.149 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))
299. 0.103 0.103 ↓ 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.031..0.103 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))
300. 0.763 0.763 ↑ 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.530..0.763 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
301. 0.137 1.139 ↑ 1.0 1,072 1

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

302. 1.002 1.002 ↑ 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.034..1.002 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))
303. 3.872 4.720 ↑ 1.0 2,319 1

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

  • Sort Key: useview_fp_follow_up_prospective_ke.source_id
  • Sort Method: quicksort Memory: 424kB
304. 0.238 0.848 ↓ 1.0 2,326 1

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

305. 0.270 0.270 ↑ 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.011..0.270 rows=930 loops=1)

306. 0.186 0.186 ↓ 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.011..0.186 rows=683 loops=1)

307. 0.154 0.154 ↑ 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.007..0.154 rows=713 loops=1)

Planning time : 48.346 ms
Execution time : 442,077.778 ms