explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sU9b

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 61.698 431,352.481 ↓ 1,842.0 1,842 1

GroupAggregate (cost=1,074,964.58..1,074,966.14 rows=1 width=650) (actual time=431,290.637..431,352.481 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: 853
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 129.291 ms, Inlining 47.046 ms, Optimization 8806.071 ms, Emission 6494.748 ms, Total 15477.157 ms
2. 18.301 431,290.783 ↓ 921.0 1,842 1

Sort (cost=1,074,964.58..1,074,964.59 rows=2 width=1,986) (actual time=431,290.493..431,290.783 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. 5.901 431,272.482 ↓ 921.0 1,842 1

Merge Left Join (cost=1,026,445.64..1,074,964.57 rows=2 width=1,986) (actual time=21,698.349..431,272.482 rows=1,842 loops=1)

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

Merge Left Join (cost=1,023,440.10..1,071,244.50 rows=2 width=1,934) (actual time=21,686.907..431,253.290 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = useview_home_visit.reported_by)
  • Join Filter: (chwlist.interval_number = (0))
5. 3.404 430,719.357 ↓ 921.0 1,842 1

Merge Left Join (cost=975,962.87..1,022,248.63 rows=2 width=1,926) (actual time=21,359.329..430,719.357 rows=1,842 loops=1)

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

Merge Left Join (cost=967,807.69..1,014,093.35 rows=2 width=1,918) (actual time=21,257.231..430,613.863 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = dr.chw)
  • Join Filter: (chwlist.interval_number = (0))
7. 6.804 430,595.879 ↓ 921.0 1,842 1

Merge Left Join (cost=967,574.41..1,013,857.55 rows=2 width=1,902) (actual time=21,247.062..430,595.879 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess_u1fu_pnc_aggregated.chw)
  • Join Filter: (chwlist.interval_number = (0))
8. 8.175 430,222.452 ↓ 921.0 1,842 1

Merge Left Join (cost=948,575.23..994,837.83 rows=2 width=1,862) (actual time=20,976.712..430,222.452 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=944,325.48..990,474.35 rows=2 width=1,846) (actual time=20,854.984..430,061.804 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. 230.089 429,247.385 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=883,786.96..929,810.43 rows=2 width=1,874) (actual time=20,369.169..429,247.385 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. 257.481 426,642.958 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=714,566.53..760,435.09 rows=2 width=1,866) (actual time=18,158.284..426,642.958 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.405 374,398.711 ↓ 1,842.0 1,842 1

Merge Left Join (cost=675,051.68..715,648.07 rows=1 width=1,822) (actual time=17,721.683..374,398.711 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = survey.chw)
  • Join Filter: (chwlist.interval_number = (0))
13. 278.464 374,305.143 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=666,565.19..706,802.80 rows=1 width=1,798) (actual time=17,693.564..374,305.143 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. 394.397 88,592.201 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=666,564.61..670,849.79 rows=1 width=1,686) (actual time=17,643.246..88,592.201 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.215 22,771.806 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=630,261.45..633,854.47 rows=1 width=1,678) (actual time=17,479.024..22,771.806 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=630,261.17..630,738.37 rows=1 width=1,674) (actual time=17,478.127..20,308.573 rows=1,842 loops=1)

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

Merge Left Join (cost=625,985.25..626,401.13 rows=1 width=1,666) (actual time=17,427.991..19,954.096 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=607,310.56..607,687.02 rows=1 width=1,658) (actual time=17,345.162..19,859.023 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=567,174.28..567,543.74 rows=1 width=1,650) (actual time=16,747.403..19,080.257 rows=1,842 loops=1)

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

Nested Loop Left Join (cost=559,190.87..559,492.99 rows=1 width=1,642) (actual time=16,716.922..18,541.291 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. 109.732 17,884.095 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=557,386.15..557,642.32 rows=1 width=1,546) (actual time=16,708.749..17,884.095 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. 74.489 17,463.065 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=556,989.92..557,208.56 rows=1 width=1,530) (actual time=16,706.730..17,463.065 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. 8.835 16,473.102 ↓ 1,842.0 1,842 1

Merge Left Join (cost=539,398.20..539,563.57 rows=1 width=1,522) (actual time=16,459.004..16,473.102 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.114 15,486.160 ↓ 1,842.0 1,842 1

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

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

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

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

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

  • Group Key: chwview_assessment.chw_uuid, 0
27. 31.227 57.616 ↑ 1.1 33,495 1

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

  • Sort Key: chwview_assessment.chw_uuid
  • Sort Method: external merge Disk: 3776kB
28. 19.178 26.389 ↑ 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.540..26.389 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.211 7.211 ↑ 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.211..7.211 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.930 15,395.310 ↓ 1,842.0 1,842 1

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

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

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

32. 1.818 15,394.139 ↓ 1,842.0 1,842 1

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

33. 0.971 15,387.629 ↓ 469.2 2,346 1

Group (cost=191.21..191.35 rows=5 width=222) (actual time=15,386.410..15,387.629 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.437 15,386.658 ↓ 469.2 2,346 1

Sort (cost=191.21..191.22 rows=5 width=222) (actual time=15,386.389..15,386.658 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.366 15,379.221 ↓ 469.2 2,346 1

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

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

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

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

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

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

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

39. 1.188 22.287 ↓ 2,346.0 2,346 1

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

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

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

41. 0.276 16.604 ↓ 2,346.0 2,346 1

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

42. 0.603 2.252 ↓ 2,346.0 2,346 1

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

43. 0.089 0.089 ↓ 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.081..0.089 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.261 1.560 ↓ 1.0 180 13

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

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

Bitmap Index Scan on contactview_chp_branch_uuid (cost=0.00..3.79 rows=175 width=0) (actual time=0.023..0.023 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. 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)

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.013 0.013 ↑ 1.0 1 1

Function Scan on generate_series generate_series_1 (cost=0.05..0.06 rows=1 width=4) (actual time=0.013..0.013 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.666 978.107 ↓ 1.4 680 1

GroupAggregate (cost=508,852.05..509,010.37 rows=469 width=88) (actual time=973.899..978.107 rows=680 loops=1)

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

CTE u1s

53. 0.554 138.223 ↓ 1.1 2,230 1

Group (cost=33,923.70..33,948.23 rows=1,962 width=82) (actual time=137.520..138.223 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.103 137.669 ↓ 1.1 2,230 1

Sort (cost=33,923.70..33,928.61 rows=1,962 width=82) (actual time=137.498..137.669 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. 133.566 133.566 ↓ 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.117..133.566 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.950 974.441 ↑ 4.6 1,029 1

Sort (cost=474,903.82..474,915.55 rows=4,691 width=64) (actual time=973.886..974.441 rows=1,029 loops=1)

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

Subquery Scan on anc_pnc_u1fu (cost=451,976.48..474,617.77 rows=4,691 width=64) (actual time=961.511..973.491 rows=1,029 loops=1)

58. 9.618 973.343 ↑ 4.6 1,029 1

GroupAggregate (cost=451,976.48..474,570.86 rows=4,691 width=100) (actual time=961.509..973.343 rows=1,029 loops=1)

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

Sort (cost=451,976.48..455,197.54 rows=1,288,427 width=183) (actual time=961.460..963.725 rows=8,776 loops=1)

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

Merge Right Join (cost=82,008.52..120,028.21 rows=1,288,427 width=183) (actual time=636.729..949.832 rows=8,776 loops=1)

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

62. 2.217 812.536 ↑ 59.5 8,776 1

Materialize (cost=82,008.10..92,166.31 rows=522,451 width=182) (actual time=636.232..812.536 rows=8,776 loops=1)

63. 35.690 810.319 ↑ 138.2 3,781 1

Merge Left Join (cost=82,008.10..90,860.18 rows=522,451 width=182) (actual time=636.229..810.319 rows=3,781 loops=1)

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

Sort (cost=50,852.60..51,137.86 rows=114,104 width=145) (actual time=214.194..214.425 rows=1,029 loops=1)

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

Hash Left Join (cost=26,472.83..31,214.67 rows=114,104 width=145) (actual time=210.301..212.808 rows=1,029 loops=1)

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

Subquery Scan on pmb (cost=25,028.35..26,318.41 rows=46,911 width=108) (actual time=199.907..200.779 rows=1,029 loops=1)

67. 0.585 200.671 ↑ 45.6 1,029 1

Group (cost=25,028.35..25,849.30 rows=46,911 width=176) (actual time=199.906..200.671 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. 3.951 200.086 ↑ 21.6 2,171 1

Sort (cost=25,028.35..25,145.63 rows=46,911 width=172) (actual time=199.897..200.086 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.567 196.135 ↑ 21.6 2,171 1

Merge Join (cost=13,080.60..19,039.31 rows=46,911 width=172) (actual time=174.648..196.135 rows=2,171 loops=1)

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

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

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

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

72. 0.850 54.620 ↑ 2.2 2,171 1

Materialize (cost=12,934.06..18,191.25 rows=4,782 width=141) (actual time=34.902..54.620 rows=2,171 loops=1)

73. 0.976 53.770 ↑ 2.4 1,978 1

Nested Loop (cost=12,934.06..18,179.30 rows=4,782 width=141) (actual time=34.899..53.770 rows=1,978 loops=1)

74. 5.816 40.974 ↓ 1.0 1,970 1

GroupAggregate (cost=12,933.64..12,972.42 rows=1,939 width=69) (actual time=34.882..40.974 rows=1,970 loops=1)

  • Group Key: pd.family_uuid
75. 1.545 35.158 ↓ 1.8 3,467 1

Sort (cost=12,933.64..12,938.49 rows=1,939 width=74) (actual time=34.835..35.158 rows=3,467 loops=1)

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

Nested Loop (cost=0.42..12,827.76 rows=1,939 width=74) (actual time=0.043..33.613 rows=3,467 loops=1)

77. 0.515 0.515 ↓ 1.1 2,230 1

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

78. 31.220 31.220 ↓ 2.0 2 2,230

Index Scan using useview_population_demographics_family_uuid_idx on useview_population_demographics pd (cost=0.42..6.51 rows=1 width=74) (actual time=0.010..0.014 rows=2 loops=2,230)

  • Index Cond: (family_uuid = u1s_1.family_uuid)
  • Filter: ((sex = 'female'::text) AND ((date_part('years'::text, age(now(), (date_of_birth)::timestamp with time zone)))::integer >= 15))
  • Rows Removed by Filter: 4
79. 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.005..0.006 rows=1 loops=1,970)

  • Index Cond: (patient_id = (string_agg(DISTINCT pd.uuid, ','::text)))
80. 5.275 10.309 ↑ 1.0 17,710 1

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

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

82. 34.817 560.204 ↓ 1.0 178,083 1

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

83. 494.364 525.387 ↑ 1.0 177,852 1

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

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

85. 489.972 915.474 ↑ 2.8 429 1,842

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

  • Group Key: contactview_metadata.parent_uuid, 0
86. 178.887 425.502 ↑ 1.6 743 1,842

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

  • Sort Key: contactview_metadata.parent_uuid
  • Sort Method: quicksort Memory: 144kB
87. 246.615 246.615 ↑ 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.154..246.615 rows=852 loops=1)

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

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

  • Group Key: useview_pregnancy.chw, 0
89. 1.133 1.133 ↑ 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.069..1.133 rows=1,398 loops=1)

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

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

  • Group Key: pnc_1.chw, 0
91. 4.253 4.253 ↑ 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.086..4.253 rows=1,482 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Filter: (follow_up_count = '1'::text)
  • Rows Removed by Filter: 4315
92. 371.118 399.714 ↑ 2.2 862 1,842

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

  • Group Key: anc.chw, 0
93. 1.129 28.596 ↓ 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=27.504..28.596 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
94. 27.467 27.467 ↓ 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=27.467..27.467 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))
95. 126.487 723.906 ↓ 1.6 324 1,842

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

  • Group Key: p.chw, 0
96. 2.948 597.419 ↑ 216.6 434 1

Hash Left Join (cost=38,237.68..39,431.17 rows=94,014 width=76) (actual time=573.497..597.419 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
97. 19.643 433.302 ↑ 2.0 751 1

GroupAggregate (cost=26,640.55..27,452.61 rows=1,525 width=76) (actual time=412.279..433.302 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
98. 24.427 413.659 ↓ 1.3 11,506 1

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

  • Sort Key: p.chw, p.patient_id
  • Sort Method: quicksort Memory: 1918kB
99. 7.998 389.232 ↓ 1.3 11,506 1

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

  • Merge Cond: (p.patient_id = useview_pregnancy_visit_1.patient_id)
100. 28.894 332.302 ↓ 1.6 18,563 1

Merge Join (cost=15,916.00..21,026.83 rows=11,364 width=78) (actual time=222.472..332.302 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
101. 7.739 255.605 ↑ 1.8 16,977 1

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

102. 124.980 247.866 ↑ 1.1 48,688 1

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

  • Sort Key: useview_pregnancy_visit.patient_id, useview_pregnancy_visit.reported DESC
  • Sort Method: external merge Disk: 2944kB
103. 122.886 122.886 ↑ 1.1 48,688 1

Seq Scan on useview_pregnancy_visit (cost=0.00..10,826.20 rows=52,759 width=47) (actual time=45.937..122.886 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
104. 47.803 47.803 ↓ 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..47.803 rows=60,660 loops=1)

105. 1.967 48.932 ↑ 1.6 6,783 1

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

106. 17.847 46.965 ↑ 1.5 8,347 1

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

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

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

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

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

  • Buckets: 32768 Batches: 2 Memory Usage: 1946kB
109. 23.654 146.613 ↓ 1.2 43,086 1

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

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

  • Filter: (follow_up_count = '1'::text)
  • Rows Removed by Filter: 87359
111. 1.177 88.480 ↑ 1.1 1,033 1

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

112. 2.994 87.303 ↑ 1.1 1,033 1

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

  • Group Key: assess.chw, 0
113. 6.298 84.309 ↓ 3.7 4,151 1

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

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

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

115. 4.132 29.559 ↓ 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.644..29.559 rows=5,602 loops=1)

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

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

117. 7.933 7.933 ↓ 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=7.933..7.933 rows=29,891 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone) AND (patient_age_in_years < 5))
118. 17.376 17.376 ↓ 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.376..17.376 rows=175,711 loops=1)

  • Index Cond: (referral_follow_up = 'true'::text)
119. 44.816 44.816 ↑ 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.008..0.008 rows=1 loops=5,602)

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

HashAggregate (cost=4,275.92..4,293.44 rows=1,752 width=48) (actual time=0.028..0.146 rows=506 loops=1,842)

  • Group Key: meta.chw, 0
121. 49.343 49.343 ↑ 2.2 1,528 1

Index Scan using form_metadata_formname on form_metadata meta (cost=0.43..4,250.23 rows=3,426 width=77) (actual time=10.165..49.343 rows=1,528 loops=1)

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

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

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

SubPlan (forIndex Only Scan)

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

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

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

Index Scan using form_metadata_chw on form_metadata meta_1 (cost=0.56..2,076.45 rows=110 width=15) (actual time=1.053..1.081 rows=1 loops=1,842)

  • Index Cond: (chw = chp.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 606
126. 2.225 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)

127. 0.004 0.004 ↑ 1.0 3 1

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

128. 0.000 0.000 ↓ 0.0 0

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

129. 0.000 0.000 ↓ 0.0 0

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

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

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

131. 0.000 0.000 ↓ 0.0 0

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

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

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

133. 0.251 52.459 ↓ 0.0 0 251

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

134. 0.753 52.208 ↓ 0.0 0 251

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

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

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

136. 3.012 3.012 ↑ 1.0 1 251

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

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

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

  • Index Cond: (uuid = chw.parent_uuid)
  • Heap Fetches: 251
138. 44.929 44.929 ↓ 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.179..0.179 rows=0 loops=251)

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

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

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

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

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

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

142. 0.450 350.145 ↑ 110.0 1 251

Nested Loop (cost=1.11..2,381.42 rows=110 width=74) (actual time=1.360..1.395 rows=1 loops=251)

143. 347.886 347.886 ↑ 110.0 1 251

Index Scan using form_metadata_chw on form_metadata meta_3 (cost=0.56..2,076.45 rows=110 width=37) (actual time=1.358..1.386 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
144. 1.809 1.809 ↑ 1.0 1 201

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

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

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

146. 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))
147. 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=23) (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
148. 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))
149. 0.985 0.985 ↓ 0.0 0 197

Index Scan using pat_feedback_expr_idx8 on pat_feedback form_39 (cost=0.41..0.44 rows=1 width=654) (actual time=0.005..0.005 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. 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=636) (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))
151. 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))
152. 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))
153. 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))
154. 1.379 1.379 ↓ 0.0 0 197

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

  • Index Cond: ((doc ->> '_id'::text) = fm.uuid)
  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
155. 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))
156. 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))
157. 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=700) (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))
158. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.53..4,304.14 rows=42 width=36) (never executed)

159. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.98..4,258.88 rows=42 width=108) (never executed)

160. 0.000 0.000 ↓ 0.0 0

Append (cost=0.42..2,329.89 rows=691 width=35) (never executed)

161. 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)
162. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on pat_form_postnatal_care form_49 (cost=1,765.21..2,301.45 rows=680 width=23) (never executed)

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

Bitmap Index Scan on pat_form_postnatal_care_expr_expr1_idx1 (cost=0.00..1,765.04 rows=680 width=0) (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=654) (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=636) (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,399) (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=700) (never executed)

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

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

  • Index Cond: (uuid = (form_48.doc ->> '_id'::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))
175. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (uuid = meta_4.uuid)
  • Heap Fetches: 0
176. 48,013.572 65,425.998 ↑ 1.3 1,651 1,842

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

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

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

  • Sort Key: useview_households_visited.chw
  • Sort Method: external sort Disk: 5512kB
178. 111.243 119.014 ↑ 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=10.897..119.014 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. 7.771 7.771 ↑ 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=7.771..7.771 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. 37,954.410 285,434.478 ↑ 1.6 1,245 1,842

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

  • Group Key: population.chp_area_uuid, 0
181. 247,480.068 247,480.068 ↑ 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.068..134.354 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.614 82.163 ↑ 1.9 1,089 1

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

183. 46.129 80.549 ↑ 1.9 1,089 1

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

  • Group Key: survey.chw, 0
184. 22.313 34.420 ↑ 1.0 13,016 1

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

  • Sort Key: survey.chw
  • Sort Method: external merge Disk: 1344kB
185. 12.107 12.107 ↑ 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.050..12.107 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. 25,150.668 51,986.766 ↑ 71.4 1,122 1,842

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

  • Group Key: contactview_metadata_1.parent_uuid, 0
187. 26,769.490 26,836.098 ↑ 2.1 120,165 1,842

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

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

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

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

190. 0.290 2,210.326 ↓ 1.2 2,708 1

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

191. 1,307.314 2,210.036 ↓ 1.2 2,708 1

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

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

193. 136.620 622.596 ↑ 2.0 1,110 1,842

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

194. 0.278 485.976 ↓ 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=485.182..485.976 rows=2,222 loops=1)

195. 242.709 485.698 ↓ 1.0 2,222 1

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

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

197. 1.499 152.473 ↓ 6.6 1,312 1

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

198. 26.867 150.974 ↓ 6.6 1,312 1

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

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

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

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

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

201. 0.787 112.442 ↑ 1.0 6,137 1

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

202. 0.012 5.642 ↓ 1.0 46 1

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

203. 5.630 5.630 ↓ 1.0 46 1

Seq Scan on useview_fp_registration (cost=0.00..349.86 rows=44 width=256) (actual time=1.913..5.630 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.051 3.933 ↑ 1.0 294 1

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

205. 3.882 3.882 ↑ 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.063..3.882 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.133 102.080 ↑ 1.0 5,797 1

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

207. 100.947 100.947 ↑ 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.082..100.947 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.729 366.623 ↓ 8.2 1,630 1

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

209. 76.978 364.894 ↓ 8.2 1,630 1

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

  • Group Key: assess_u1fu_pnc_aggregated.chw, 0
210. 69.294 287.916 ↓ 184.3 36,861 1

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

  • Sort Key: assess_u1fu_pnc_aggregated.chw
  • Sort Method: external merge Disk: 3984kB
211. 5.708 218.622 ↓ 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=179.911..218.622 rows=36,861 loops=1)

212. 8.868 212.914 ↓ 184.3 36,861 1

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

213. 114.723 204.046 ↓ 1.1 40,031 1

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

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

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

215. 37.395 37.395 ↑ 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.062..37.395 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.825 2.825 ↓ 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.067..2.825 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. 44.856 44.856 ↓ 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.122..44.856 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.061 13.497 ↓ 1.6 59 1

Materialize (cost=233.27..235.68 rows=37 width=56) (actual time=10.160..13.497 rows=59 loops=1)

219. 3.280 13.436 ↓ 1.6 59 1

GroupAggregate (cost=233.27..235.22 rows=37 width=56) (actual time=10.157..13.436 rows=59 loops=1)

  • Group Key: dr.chw, 0
220. 0.166 10.156 ↓ 2.5 92 1

Sort (cost=233.27..233.37 rows=37 width=1,618) (actual time=10.108..10.156 rows=92 loops=1)

  • Sort Key: dr.chw
  • Sort Method: quicksort Memory: 210kB
221. 4.706 9.990 ↓ 2.5 92 1

Hash Right Join (cost=48.26..232.31 rows=37 width=1,618) (actual time=4.063..9.990 rows=92 loops=1)

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

Append (cost=0.42..182.68 rows=649 width=1,578) (actual time=0.026..4.625 rows=638 loops=1)

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

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

Seq Scan on pat_form_death_report form_1 (cost=0.00..154.57 rows=638 width=1,591) (actual time=0.018..4.496 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.013..0.013 rows=0 loops=1)

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

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
227. 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=636) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
228. 0.005 0.005 ↓ 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.005..0.005 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.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
231. 0.006 0.006 ↓ 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,399) (actual time=0.006..0.006 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
232. 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)
233. 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)
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=700) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
235. 0.024 0.659 ↓ 2.5 92 1

Hash (cost=47.38..47.38 rows=37 width=73) (actual time=0.659..0.659 rows=92 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
236. 0.635 0.635 ↓ 2.5 92 1

Index Scan using form_metadata_formname on form_metadata dr (cost=0.43..47.38 rows=37 width=73) (actual time=0.267..0.635 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.002 102.090 ↑ 2.0 1 1

Materialize (cost=8,155.18..8,155.25 rows=2 width=48) (actual time=102.089..102.090 rows=1 loops=1)

238. 0.009 102.088 ↑ 2.0 1 1

GroupAggregate (cost=8,155.18..8,155.22 rows=2 width=48) (actual time=102.087..102.088 rows=1 loops=1)

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

Sort (cost=8,155.18..8,155.19 rows=2 width=40) (actual time=102.079..102.079 rows=2 loops=1)

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

Result (cost=7,931.90..8,155.17 rows=2 width=40) (actual time=79.257..102.073 rows=2 loops=1)

241. 0.002 102.070 ↑ 1.0 2 1

Append (cost=7,931.90..8,155.15 rows=2 width=36) (actual time=79.255..102.070 rows=2 loops=1)

242. 0.032 79.263 ↑ 1.0 1 1

Subquery Scan on *SELECT* 1_1 (cost=7,931.90..7,932.14 rows=1 width=36) (actual time=79.254..79.263 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.013 79.231 ↓ 3.6 18 1

Unique (cost=7,931.90..7,931.93 rows=5 width=80) (actual time=79.216..79.231 rows=18 loops=1)

244. 0.052 79.218 ↓ 11.6 58 1

Sort (cost=7,931.90..7,931.92 rows=5 width=80) (actual time=79.214..79.218 rows=58 loops=1)

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

Hash Join (cost=219.64..7,931.84 rows=5 width=80) (actual time=19.005..79.166 rows=58 loops=1)

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

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

Hash (cost=219.63..219.63 rows=1 width=1,622) (actual time=17.881..17.881 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1052kB
248. 8.280 13.389 ↓ 638.0 638 1

Hash Join (cost=35.58..219.63 rows=1 width=1,622) (actual time=0.409..13.389 rows=638 loops=1)

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

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

250. 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)
251. 4.628 4.628 ↑ 1.0 638 1

Seq Scan on pat_form_death_report form_13 (cost=0.00..154.57 rows=638 width=1,591) (actual time=0.013..4.628 rows=638 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
252. 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
253. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_15 (cost=0.29..2.51 rows=1 width=654) (actual time=0.005..0.005 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=636) (actual time=0.003..0.003 rows=0 loops=1)

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

Index Scan using pat_person_expr_idx9 on pat_person form_20 (cost=0.42..2.64 rows=1 width=1,399) (actual time=0.003..0.003 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.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=700) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
262. 0.164 0.365 ↓ 1.0 638 1

Hash (cost=27.52..27.52 rows=611 width=81) (actual time=0.365..0.365 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
263. 0.201 0.201 ↓ 1.0 638 1

Index Scan using form_metadata_formname on form_metadata dr_1 (cost=0.43..27.52 rows=611 width=81) (actual time=0.013..0.201 rows=638 loops=1)

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

Subquery Scan on *SELECT* 2_1 (cost=222.95..223.00 rows=1 width=36) (actual time=22.799..22.805 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.784 ↓ 16.0 16 1

Unique (cost=222.95..222.96 rows=1 width=80) (actual time=22.773..22.784 rows=16 loops=1)

266. 0.040 22.775 ↓ 40.0 40 1

Sort (cost=222.95..222.96 rows=1 width=80) (actual time=22.772..22.775 rows=40 loops=1)

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

Nested Loop (cost=36.00..222.94 rows=1 width=80) (actual time=3.109..22.735 rows=40 loops=1)

268. 8.811 14.288 ↓ 638.0 638 1

Hash Join (cost=35.58..219.63 rows=1 width=1,622) (actual time=0.456..14.288 rows=638 loops=1)

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

Append (cost=0.42..182.68 rows=649 width=1,578) (actual time=0.029..5.081 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.943 4.943 ↑ 1.0 638 1

Seq Scan on pat_form_death_report form_25 (cost=0.00..154.57 rows=638 width=1,591) (actual time=0.018..4.943 rows=638 loops=1)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
272. 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
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=654) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
274. 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=636) (actual time=0.003..0.003 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.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
278. 0.004 0.004 ↓ 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,399) (actual time=0.004..0.004 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.002 0.002 ↓ 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.002..0.002 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=700) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
282. 0.177 0.396 ↓ 1.0 638 1

Hash (cost=27.52..27.52 rows=611 width=81) (actual time=0.396..0.396 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
283. 0.219 0.219 ↓ 1.0 638 1

Index Scan using form_metadata_formname on form_metadata dr_2 (cost=0.43..27.52 rows=611 width=81) (actual time=0.022..0.219 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.576 528.094 ↑ 1.1 1,638 1

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

286. 153.797 526.518 ↑ 1.1 1,638 1

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

  • Group Key: useview_home_visit.reported_by, 0
287. 245.221 372.721 ↑ 1.0 146,223 1

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

  • Sort Key: useview_home_visit.reported_by
  • Sort Method: external merge Disk: 13056kB
288. 127.500 127.500 ↑ 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.062..127.500 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.117 13.291 ↑ 1.9 106 1

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

290. 1.403 13.174 ↑ 1.9 106 1

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

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

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

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

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

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

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

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

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

295. 0.047 1.111 ↑ 1.0 363 1

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

296. 0.047 1.064 ↑ 1.0 363 1

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

297. 0.037 1.017 ↑ 1.0 363 1

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

298. 0.136 0.136 ↑ 1.0 122 1

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

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 mon'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
299. 0.086 0.086 ↓ 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.019..0.086 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.758 0.758 ↑ 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.529..0.758 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.066 ↑ 1.0 1,072 1

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

302. 0.929 0.929 ↑ 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.031..0.929 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.827 4.519 ↑ 1.0 2,319 1

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

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

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

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

306. 0.125 0.125 ↓ 1.0 683 1

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

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

Planning time : 45.461 ms
Execution time : 431,492.699 ms