explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hSJB

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,941,398.39..1,941,400.35 rows=1 width=647) (actual rows= loops=)

  • Group Key: chwlist.branch_uuid, chwlist.branch_name, chwlist.supervisor_uuid, chwlist.supervisor_name, chwlist.chw_uuid, chwlist.chw_name, chwlist.chw_phone, chwlist.interval_number, (date(chwlist.interval_start))
  • Functions: 843
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
2.          

CTE fp

3. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=10,052.57..10,389.15 rows=200 width=56) (actual rows= loops=)

  • Group Key: "*SELECT* 1_2".reported_by, 0
4. 0.000 0.000 ↓ 0.0

Sort (cost=10,052.57..10,100.22 rows=19,062 width=80) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_2".reported_by
5. 0.000 0.000 ↓ 0.0

Result (cost=0.00..8,697.41 rows=19,062 width=80) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Append (cost=0.00..8,506.79 rows=19,062 width=76) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_2 (cost=0.00..330.82 rows=154 width=78) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Seq Scan on useview_fp_registration (cost=0.00..329.28 rows=154 width=256) (actual rows= loops=)

  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
9. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2_2 (cost=0.43..684.81 rows=1,028 width=78) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Index Scan using index_useview_person_fp_registration_reported_chw_patient_id on useview_person_fp_registration (cost=0.43..674.53 rows=1,028 width=256) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
  • Filter: (patient_age_in_years >= 15)
11. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 3 (cost=0.44..7,395.85 rows=17,880 width=76) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_2 (cost=0.44..7,217.05 rows=17,880 width=254) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
13. 0.000 0.000 ↓ 0.0

Sort (cost=1,931,009.24..1,931,009.25 rows=3 width=1,983) (actual rows= loops=)

  • Sort Key: chwlist.branch_uuid, chwlist.branch_name, chwlist.supervisor_uuid, chwlist.supervisor_name, chwlist.chw_uuid, chwlist.chw_name, chwlist.chw_phone, chwlist.interval_number, (date(chwlist.interval_start))
14. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,643,181.69..1,931,009.22 rows=3 width=1,983) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1_1".reported_by)
  • Join Filter: (chwlist.interval_number = (0))
15. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,635,853.85..1,920,930.14 rows=3 width=1,931) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = useview_home_visit.reported_by)
  • Join Filter: (chwlist.interval_number = (0))
16. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,578,636.82..1,859,184.58 rows=3 width=1,923) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1".chw_uuid)
  • Join Filter: (chwlist.interval_number = (0))
17. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,570,467.21..1,851,014.84 rows=3 width=1,915) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = dr.chw)
  • Join Filter: (chwlist.interval_number = (0))
18. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,570,226.18..1,850,764.62 rows=3 width=1,899) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = assess_u1fu_pnc_aggregated.chw)
  • Join Filter: (chwlist.interval_number = (0))
19. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,530,195.72..1,810,713.61 rows=3 width=1,859) (actual rows= loops=)

  • Merge Cond: ((chwlist.chw_uuid = fp.chw_uuid) AND (chwlist.interval_number = fp.interval_number))
20. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,530,184.07..1,810,700.44 rows=3 width=1,843) (actual rows= loops=)

  • Join Filter: ((chwlist.chw_area_uuid = population_all_time.chw_area_uuid) AND (chwlist.interval_number = population_all_time.interval_number))
21. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,530,183.52..1,728,898.71 rows=3 width=1,871) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = useview_chp_sync.chw_uuid)
  • Join Filter: (chwlist.interval_number = (0))
22. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,530,182.96..1,564,977.10 rows=3 width=1,863) (actual rows= loops=)

  • Join Filter: ((chwlist.chw_area_uuid = contactview_metadata_1.parent_uuid) AND (chwlist.interval_number = (0)))
23. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,499,225.85..1,526,948.36 rows=1 width=1,819) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = survey.chw)
  • Join Filter: (chwlist.interval_number = (0))
24. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,481,412.45..1,508,183.83 rows=1 width=1,795) (actual rows= loops=)

  • Join Filter: ((chwlist.chw_area_uuid = population.chp_area_uuid) AND (chwlist.interval_number = (0)))
25. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,465,761.55..1,486,291.89 rows=1 width=1,683) (actual rows= loops=)

  • Join Filter: ((chwlist.chw_uuid = useview_households_visited.chw) AND (chwlist.interval_number = (0)))
26. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,444,260.01..1,462,902.57 rows=1 width=1,675) (actual rows= loops=)

  • Join Filter: (chwlist.interval_number = 0)
27. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,444,259.73..1,459,316.84 rows=1 width=1,671) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = meta.chw)
  • Join Filter: (chwlist.interval_number = (0))
28. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,440,298.00..1,455,202.44 rows=1 width=1,663) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = assess.chw)
  • Join Filter: (chwlist.interval_number = (0))
29. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,408,451.16..1,423,269.33 rows=1 width=1,655) (actual rows= loops=)

  • Join Filter: ((chwlist.chw_uuid = chwview_assessment.chw_uuid) AND (chwlist.interval_number = (0)))
30. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,378,398.43..1,381,730.77 rows=1 width=403) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = p.chw)
  • Join Filter: (chwlist.interval_number = (0))
31. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,336,921.39..1,339,143.00 rows=1 width=395) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = anc.chw)
  • Join Filter: (chwlist.interval_number = (0))
32. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,326,925.03..1,328,929.75 rows=1 width=387) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = pnc_1.chw)
  • Join Filter: (chwlist.interval_number = (0))
33. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,323,819.83..1,325,008.92 rows=1 width=291) (actual rows= loops=)

  • Merge Cond: (chwlist.chw_uuid = useview_pregnancy.chw)
  • Join Filter: (chwlist.interval_number = (0))
34. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,322,800.62..1,323,843.02 rows=1 width=275) (actual rows= loops=)

  • Merge Cond: ((chwlist.chw_uuid = anc_pnc_u1fu.chw_uuid) AND (chwlist.interval_number = anc_pnc_u1fu.interval_number))
35. 0.000 0.000 ↓ 0.0

Sort (cost=15,321.04..15,321.04 rows=1 width=227) (actual rows= loops=)

  • Sort Key: chwlist.chw_uuid, chwlist.interval_number
36. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=15,173.98..15,321.03 rows=1 width=227) (actual rows= loops=)

  • Hash Cond: ((contactview_metadata.parent_uuid = chwlist.chw_area_uuid) AND ((0) = chwlist.interval_number))
37. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=14,976.08..15,054.69 rows=3,910 width=48) (actual rows= loops=)

  • Group Key: contactview_metadata.parent_uuid, 0
38. 0.000 0.000 ↓ 0.0

Sort (cost=14,976.08..14,985.96 rows=3,951 width=76) (actual rows= loops=)

  • Sort Key: contactview_metadata.parent_uuid
39. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_type on contactview_metadata (cost=0.43..14,740.05 rows=3,951 width=76) (actual rows= loops=)

  • Index Cond: (type = 'clinic'::text)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
40. 0.000 0.000 ↓ 0.0

Hash (cost=197.89..197.89 rows=1 width=219) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Subquery Scan on chwlist (cost=184.35..197.89 rows=1 width=219) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Nested Loop Anti Join (cost=184.35..197.88 rows=1 width=219) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Group (cost=184.08..184.63 rows=20 width=219) (actual rows= loops=)

  • 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, ('2019-08-01'::date)::timestamp with time zone)), (0)
44. 0.000 0.000 ↓ 0.0

Sort (cost=184.08..184.13 rows=20 width=219) (actual rows= loops=)

  • 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, ('2019-08-01'::date)::timestamp with time zone)), (0)
45. 0.000 0.000 ↓ 0.0

Hash Join (cost=147.19..183.64 rows=20 width=219) (actual rows= loops=)

  • Hash Cond: ((row_number() OVER (?)) = (row_number() OVER (?)))
46. 0.000 0.000 ↓ 0.0

WindowAgg (cost=59.84..82.34 rows=1,000 width=24) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Sort (cost=59.84..62.34 rows=1,000 width=8) (actual rows= loops=)

  • Sort Key: generate_series.generate_series
48. 0.000 0.000 ↓ 0.0

Function Scan on generate_series (cost=0.01..10.01 rows=1,000 width=8) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Hash (cost=87.31..87.31 rows=4 width=219) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.25..87.31 rows=4 width=219) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..87.04 rows=1 width=207) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..84.77 rows=1 width=191) (actual rows= loops=)

53. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_type on contactview_metadata cmd (cost=0.43..1.45 rows=1 width=52) (actual rows= loops=)

  • Index Cond: (type = 'district_hospital'::text)
54. 0.000 0.000 ↓ 0.0

Index Scan using contactview_chp_branch_uuid on contactview_chp chp_1 (cost=0.28..81.58 rows=175 width=172) (actual rows= loops=)

  • Index Cond: (branch_uuid = cmd.uuid)
55. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_uuid on contactview_metadata cmeta (cost=0.43..2.27 rows=1 width=52) (actual rows= loops=)

  • Index Cond: (uuid = chp_1.supervisor_uuid)
56. 0.000 0.000 ↓ 0.0

WindowAgg (cost=0.11..0.18 rows=4 width=16) (actual rows= loops=)

57. 0.000 0.000 ↓ 0.0

Sort (cost=0.11..0.12 rows=4 width=4) (actual rows= loops=)

  • Sort Key: generate_series_1.generate_series
58. 0.000 0.000 ↓ 0.0

Function Scan on generate_series generate_series_1 (cost=0.03..0.07 rows=4 width=4) (actual rows= loops=)

59. 0.000 0.000 ↓ 0.0

Index Only Scan using chp_muting_chw on chp_muting (cost=0.28..0.64 rows=1 width=37) (actual rows= loops=)

  • Index Cond: (chw = chp_1.uuid)
60. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,307,479.59..1,308,477.61 rows=2,957 width=88) (actual rows= loops=)

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

CTE u1s

62. 0.000 0.000 ↓ 0.0

Group (cost=15,071.44..15,141.55 rows=5,609 width=81) (actual rows= loops=)

  • Group Key: useview_population_demographics.family_uuid, useview_population_demographics.uuid, useview_population_demographics.date_of_birth, 0
63. 0.000 0.000 ↓ 0.0

Sort (cost=15,071.44..15,085.46 rows=5,609 width=81) (actual rows= loops=)

  • Sort Key: useview_population_demographics.family_uuid, useview_population_demographics.uuid, useview_population_demographics.date_of_birth
64. 0.000 0.000 ↓ 0.0

Index Scan using useview_population_demographics_reported_idx on useview_population_demographics (cost=0.44..14,722.18 rows=5,609 width=81) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
  • Filter: ((date_part('years'::text, age(now(), (date_of_birth)::timestamp with time zone)))::integer <= 1)
65. 0.000 0.000 ↓ 0.0

Sort (cost=1,292,338.03..1,292,411.96 rows=29,571 width=64) (actual rows= loops=)

  • Sort Key: anc_pnc_u1fu.chw_uuid, anc_pnc_u1fu.interval_number
66. 0.000 0.000 ↓ 0.0

Subquery Scan on anc_pnc_u1fu (cost=1,194,940.35..1,290,142.11 rows=29,571 width=64) (actual rows= loops=)

67. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,194,940.35..1,289,846.40 rows=29,571 width=100) (actual rows= loops=)

  • Group Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
68. 0.000 0.000 ↓ 0.0

Sort (cost=1,194,940.35..1,208,456.11 rows=5,406,305 width=183) (actual rows= loops=)

  • Sort Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
69. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=176,570.75..315,807.55 rows=5,406,305 width=183) (actual rows= loops=)

  • Hash Cond: (pmb.baby_uuid = u1fu.patient_id)
70. 0.000 0.000 ↓ 0.0

Merge Right Join (cost=175,351.28..235,520.10 rows=2,222,660 width=146) (actual rows= loops=)

  • Merge Cond: (pc.patient_id = pmb.mother_uuid)
71. 0.000 0.000 ↓ 0.0

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pc (cost=0.42..8,825.94 rows=135,768 width=73) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Materialize (cost=175,350.86..195,712.41 rows=1,079,030 width=145) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=175,350.86..193,014.84 rows=1,079,030 width=145) (actual rows= loops=)

  • Merge Cond: (pmb.mother_uuid = pv.patient_id)
74. 0.000 0.000 ↓ 0.0

Sort (cost=153,455.59..154,194.85 rows=295,706 width=108) (actual rows= loops=)

  • Sort Key: pmb.mother_uuid
75. 0.000 0.000 ↓ 0.0

Subquery Scan on pmb (cost=118,453.16..126,585.07 rows=295,706 width=108) (actual rows= loops=)

76. 0.000 0.000 ↓ 0.0

Group (cost=118,453.16..123,628.01 rows=295,706 width=176) (actual rows= loops=)

  • Group Key: pnc.chw, u1s.family_uuid, (string_agg(DISTINCT pd.uuid, ','::text)), pnc.patient_id, u1s.uuid, u1s.interval_number
77. 0.000 0.000 ↓ 0.0

Sort (cost=118,453.16..119,192.42 rows=295,706 width=172) (actual rows= loops=)

  • Sort Key: pnc.chw, u1s.family_uuid, (string_agg(DISTINCT pd.uuid, ','::text)), u1s.uuid, u1s.interval_number
78. 0.000 0.000 ↓ 0.0

Merge Join (cost=63,677.38..77,142.64 rows=295,706 width=172) (actual rows= loops=)

  • Merge Cond: (pd.family_uuid = u1s.family_uuid)
79. 0.000 0.000 ↓ 0.0

Nested Loop (cost=63,215.94..72,219.25 rows=10,544 width=141) (actual rows= loops=)

80. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63,215.52..63,317.90 rows=5,119 width=69) (actual rows= loops=)

  • Group Key: pd.family_uuid
81. 0.000 0.000 ↓ 0.0

Sort (cost=63,215.52..63,228.32 rows=5,119 width=73) (actual rows= loops=)

  • Sort Key: pd.family_uuid
82. 0.000 0.000 ↓ 0.0

Hash Join (cost=62,309.09..62,900.15 rows=5,119 width=73) (actual rows= loops=)

  • Hash Cond: (u1s_1.family_uuid = pd.family_uuid)
83. 0.000 0.000 ↓ 0.0

CTE Scan on u1s u1s_1 (cost=0.00..112.18 rows=5,609 width=32) (actual rows= loops=)

84. 0.000 0.000 ↓ 0.0

Hash (cost=60,081.36..60,081.36 rows=178,219 width=73) (actual rows= loops=)

85. 0.000 0.000 ↓ 0.0

Index Scan using useview_population_demographics_sex_date_of_birth_idx on useview_population_demographics pd (cost=0.42..60,081.36 rows=178,219 width=73) (actual rows= loops=)

  • Index Cond: (sex = 'female'::text)
  • Filter: ((date_part('years'::text, age(now(), (date_of_birth)::timestamp with time zone)))::integer >= 15)
86. 0.000 0.000 ↓ 0.0

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pnc (cost=0.42..1.71 rows=2 width=72) (actual rows= loops=)

  • Index Cond: (patient_id = (string_agg(DISTINCT pd.uuid, ','::text)))
87. 0.000 0.000 ↓ 0.0

Sort (cost=461.44..475.46 rows=5,609 width=68) (actual rows= loops=)

  • Sort Key: u1s.family_uuid
88. 0.000 0.000 ↓ 0.0

CTE Scan on u1s (cost=0.00..112.18 rows=5,609 width=68) (actual rows= loops=)

89. 0.000 0.000 ↓ 0.0

Sort (cost=21,895.27..22,340.11 rows=177,936 width=73) (actual rows= loops=)

  • Sort Key: pv.patient_id
90. 0.000 0.000 ↓ 0.0

Seq Scan on useview_pregnancy_visit pv (cost=0.00..6,378.36 rows=177,936 width=73) (actual rows= loops=)

91. 0.000 0.000 ↓ 0.0

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

92. 0.000 0.000 ↓ 0.0

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

93. 0.000 0.000 ↓ 0.0

Materialize (cost=1,019.21..1,161.01 rows=1,910 width=56) (actual rows= loops=)

94. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,019.21..1,137.13 rows=1,910 width=56) (actual rows= loops=)

  • Group Key: useview_pregnancy.chw, 0
95. 0.000 0.000 ↓ 0.0

Sort (cost=1,019.21..1,030.19 rows=4,392 width=78) (actual rows= loops=)

  • Sort Key: useview_pregnancy.chw
96. 0.000 0.000 ↓ 0.0

Index Scan using useview_pregnancy_reported on useview_pregnancy (cost=0.31..753.48 rows=4,392 width=78) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
97. 0.000 0.000 ↓ 0.0

Materialize (cost=3,105.19..3,915.64 rows=2,020 width=136) (actual rows= loops=)

98. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=3,105.19..3,890.39 rows=2,020 width=136) (actual rows= loops=)

  • Group Key: pnc_1.chw, 0
99. 0.000 0.000 ↓ 0.0

Sort (cost=3,105.19..3,121.13 rows=6,375 width=101) (actual rows= loops=)

  • Sort Key: pnc_1.chw
100. 0.000 0.000 ↓ 0.0

Index Scan using useview_postnatal_reported on useview_postnatal_care pnc_1 (cost=0.44..2,702.35 rows=6,375 width=101) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
  • Filter: (follow_up_count = '1'::text)
101. 0.000 0.000 ↓ 0.0

Materialize (cost=9,996.36..10,207.76 rows=2,140 width=48) (actual rows= loops=)

102. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=9,996.36..10,181.01 rows=2,140 width=48) (actual rows= loops=)

  • Group Key: anc.chw, 0
103. 0.000 0.000 ↓ 0.0

Sort (cost=9,996.36..10,037.17 rows=16,325 width=40) (actual rows= loops=)

  • Sort Key: anc.chw
104. 0.000 0.000 ↓ 0.0

Index Scan using useview_pregnancy_visit_pregnancy_reported_uuid on useview_pregnancy_visit anc (cost=0.44..8,854.03 rows=16,325 width=40) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
105. 0.000 0.000 ↓ 0.0

Materialize (cost=41,477.04..42,587.26 rows=200 width=48) (actual rows= loops=)

106. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=41,477.04..42,584.76 rows=200 width=48) (actual rows= loops=)

  • Group Key: p.chw, 0
107. 0.000 0.000 ↓ 0.0

Sort (cost=41,477.04..41,753.47 rows=110,572 width=76) (actual rows= loops=)

  • Sort Key: p.chw
108. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=31,603.98..32,214.08 rows=110,572 width=76) (actual rows= loops=)

  • Hash Cond: (p.patient_id = useview_postnatal_care.patient_id)
  • Filter: (((max(useview_postnatal_care.reported)) IS NULL) OR ((@ ((CASE WHEN (max(pv_1.new_edd) <> ''::text) THEN (max(pv_1.new_edd))::date ELSE max(p.edd) END) - ((max(useview_postnatal_care.reported)))::date)) > 60))
109. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=20,918.25..21,507.10 rows=1,670 width=76) (actual rows= loops=)

  • Group Key: p.chw, p.patient_id
  • Filter: ((max(p.edd) >= date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone)) AND CASE WHEN (date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) = date_trunc('day'::text, now())) THEN (max(p.edd) <= '2019-10-29 00:00:00'::timestamp without time zone) ELSE (max(p.edd) <= '2019-11-02 00:00:00'::timestamp without time zone) END)
110. 0.000 0.000 ↓ 0.0

Sort (cost=20,918.25..20,943.31 rows=10,023 width=78) (actual rows= loops=)

  • Sort Key: p.chw, p.patient_id
111. 0.000 0.000 ↓ 0.0

Hash Anti Join (cost=17,088.60..20,252.17 rows=10,023 width=78) (actual rows= loops=)

  • Hash Cond: (p.patient_id = upv.patient_id)
112. 0.000 0.000 ↓ 0.0

Hash Join (cost=12,643.28..15,670.12 rows=12,742 width=78) (actual rows= loops=)

  • Hash Cond: (p.patient_id = pv_1.patient_id)
  • Join Filter: (p.reported < pv_1.reported)
113. 0.000 0.000 ↓ 0.0

Seq Scan on useview_pregnancy p (cost=0.00..2,867.60 rows=60,660 width=84) (actual rows= loops=)

114. 0.000 0.000 ↓ 0.0

Hash (cost=12,193.91..12,193.91 rows=35,950 width=46) (actual rows= loops=)

115. 0.000 0.000 ↓ 0.0

Subquery Scan on pv_1 (cost=11,561.56..12,193.91 rows=35,950 width=46) (actual rows= loops=)

116. 0.000 0.000 ↓ 0.0

Unique (cost=11,561.56..11,834.41 rows=35,950 width=47) (actual rows= loops=)

117. 0.000 0.000 ↓ 0.0

Sort (cost=11,561.56..11,697.98 rows=54,570 width=47) (actual rows= loops=)

  • Sort Key: useview_pregnancy_visit.patient_id, useview_pregnancy_visit.reported DESC
118. 0.000 0.000 ↓ 0.0

Seq Scan on useview_pregnancy_visit (cost=0.00..7,268.04 rows=54,570 width=47) (actual rows= loops=)

  • Filter: (((edd_updated IS TRUE) AND (reported > '2018-11-01 00:00:00'::timestamp without time zone)) OR (reported > '2019-02-01 00:00:00'::timestamp without time zone))
119. 0.000 0.000 ↓ 0.0

Hash (cost=4,293.13..4,293.13 rows=12,175 width=36) (actual rows= loops=)

120. 0.000 0.000 ↓ 0.0

Subquery Scan on upv (cost=4,104.03..4,293.13 rows=12,175 width=36) (actual rows= loops=)

121. 0.000 0.000 ↓ 0.0

Unique (cost=4,104.03..4,171.38 rows=12,175 width=44) (actual rows= loops=)

122. 0.000 0.000 ↓ 0.0

Sort (cost=4,104.03..4,137.71 rows=13,470 width=44) (actual rows= loops=)

  • Sort Key: useview_pregnancy_visit_1.patient_id, useview_pregnancy_visit_1.reported DESC
123. 0.000 0.000 ↓ 0.0

Index Scan using useview_pregnancy_visit_continue_follow_up on useview_pregnancy_visit useview_pregnancy_visit_1 (cost=0.42..3,180.16 rows=13,470 width=44) (actual rows= loops=)

  • Index Cond: (continue_follow_up = false)
  • Filter: ((reported > '2018-11-01 00:00:00'::timestamp without time zone) OR (reported > '2019-02-01 00:00:00'::timestamp without time zone))
124. 0.000 0.000 ↓ 0.0

Hash (cost=10,194.06..10,194.06 rows=39,333 width=44) (actual rows= loops=)

125. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.42..9,800.73 rows=39,333 width=44) (actual rows= loops=)

  • Group Key: useview_postnatal_care.patient_id
126. 0.000 0.000 ↓ 0.0

Index Scan using useview_postnatal_patient_id on useview_postnatal_care (cost=0.42..9,165.36 rows=48,409 width=44) (actual rows= loops=)

  • Filter: (follow_up_count = '1'::text)
127. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=30,052.73..41,463.69 rows=2,139 width=1,292) (actual rows= loops=)

  • Group Key: chwview_assessment.chw_uuid, 0
128. 0.000 0.000 ↓ 0.0

Sort (cost=30,052.73..30,312.50 rows=103,910 width=352) (actual rows= loops=)

  • Sort Key: chwview_assessment.chw_uuid
129. 0.000 0.000 ↓ 0.0

Index Scan using chwview_assessment_reported_chw_uuid on chwview_assessment (cost=0.44..21,394.44 rows=103,910 width=352) (actual rows= loops=)

  • Index Cond: ((reported_day >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported_day < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
130. 0.000 0.000 ↓ 0.0

Materialize (cost=31,846.84..31,927.63 rows=2,136 width=48) (actual rows= loops=)

131. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=31,846.84..31,900.93 rows=2,136 width=48) (actual rows= loops=)

  • Group Key: assess.chw, 0
132. 0.000 0.000 ↓ 0.0

Sort (cost=31,846.84..31,855.03 rows=3,273 width=77) (actual rows= loops=)

  • Sort Key: assess.chw
133. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4,040.17..31,655.76 rows=3,273 width=77) (actual rows= loops=)

134. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on useview_assessment assess (cost=4,039.74..16,852.61 rows=14,103 width=81) (actual rows= loops=)

  • Recheck Cond: ((referral_follow_up = 'true'::text) AND (reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone) AND (patient_age_in_years < 5))
135. 0.000 0.000 ↓ 0.0

BitmapAnd (cost=4,039.74..4,039.74 rows=14,103 width=0) (actual rows= loops=)

136. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on useview_assessment_referral_follow_up (cost=0.00..1,791.71 rows=174,705 width=0) (actual rows= loops=)

  • Index Cond: (referral_follow_up = 'true'::text)
137. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on useview_assessment_reported_age_uuid (cost=0.00..2,240.73 rows=82,354 width=0) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone) AND (patient_age_in_years < 5))
138. 0.000 0.000 ↓ 0.0

Index Only Scan using useview_assessment_follow_up_source_date_uuid on useview_assessment_follow_up follow_up (cost=0.42..1.04 rows=1 width=45) (actual rows= loops=)

  • Index Cond: (form_source_id = assess.uuid)
  • Filter: ((date(date_trunc('day'::text, reported)) - date(date_trunc('day'::text, assess.reported))) <= 2)
139. 0.000 0.000 ↓ 0.0

Materialize (cost=3,961.73..4,108.31 rows=2,374 width=48) (actual rows= loops=)

140. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=3,961.73..4,078.64 rows=2,374 width=48) (actual rows= loops=)

  • Group Key: meta.chw, 0
141. 0.000 0.000 ↓ 0.0

Sort (cost=3,961.73..3,985.02 rows=9,317 width=76) (actual rows= loops=)

  • Sort Key: meta.chw
142. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_formname on form_metadata meta (cost=0.43..3,347.47 rows=9,317 width=76) (actual rows= loops=)

  • Index Cond: (formname = 'community_event'::text)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
143. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (uuid = chwlist.chw_uuid)
144.          

SubPlan (for Index Only Scan)

145. 0.000 0.000 ↓ 0.0

Nested Loop Semi Join (cost=0.56..1,744.91 rows=20 width=0) (actual rows= loops=)

  • Join Filter: (meta_1.formname = "*VALUES*".column1)
146. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_chw on form_metadata meta_1 (cost=0.56..1,731.23 rows=303 width=15) (actual rows= loops=)

  • Index Cond: (chw = chp.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
147. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..0.05 rows=3 width=32) (actual rows= loops=)

148. 0.000 0.000 ↓ 0.0

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

149. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.49..17,458.27 rows=47,868 width=36) (actual rows= loops=)

150. 0.000 0.000 ↓ 0.0

Unique (cost=0.06..0.08 rows=3 width=32) (actual rows= loops=)

151. 0.000 0.000 ↓ 0.0

Sort (cost=0.06..0.07 rows=3 width=32) (actual rows= loops=)

  • Sort Key: "*VALUES*_1".column1
152. 0.000 0.000 ↓ 0.0

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

153. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_formname on form_metadata meta_2 (cost=0.43..5,659.84 rows=15,956 width=51) (actual rows= loops=)

  • Index Cond: (formname = "*VALUES*_1".column1)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
154. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.99..10.49 rows=13 width=0) (actual rows= loops=)

155. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.71..8.16 rows=1 width=1,401) (actual rows= loops=)

156. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.28..5.70 rows=1 width=36) (actual rows= loops=)

  • Join Filter: (chw.parent_uuid = cmd_1.parent_uuid)
157. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..4.89 rows=1 width=108) (actual rows= loops=)

158. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_uuid on contactview_metadata chw (cost=0.43..2.45 rows=1 width=72) (actual rows= loops=)

  • Index Cond: (uuid = chp.uuid)
159. 0.000 0.000 ↓ 0.0

Index Only Scan using contactview_metadata_uuid on contactview_metadata chwarea (cost=0.43..2.45 rows=1 width=36) (actual rows= loops=)

  • Index Cond: (uuid = chw.parent_uuid)
160. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_parent_uuid on contactview_metadata cmd_1 (cost=0.43..0.79 rows=1 width=36) (actual rows= loops=)

  • Index Cond: (parent_uuid = chwarea.uuid)
  • Filter: ((type = 'clinic'::text) AND (reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
161. 0.000 0.000 ↓ 0.0

Index Scan using pat_person_expr_idx8 on pat_person (cost=0.42..2.46 rows=1 width=1,401) (actual rows= loops=)

  • 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[])))
162. 0.000 0.000 ↓ 0.0

Index Scan using pat_health_center_expr_idx8 on pat_health_center (cost=0.28..2.31 rows=1 width=957) (actual rows= loops=)

  • 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[])))
163. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.99..102,269.52 rows=875,088 width=32) (actual rows= loops=)

164. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.71..77,411.30 rows=69,951 width=1,401) (actual rows= loops=)

165. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.28..22,443.30 rows=88,571 width=36) (actual rows= loops=)

166. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..19,784.24 rows=3,951 width=72) (actual rows= loops=)

167. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_type on contactview_metadata cmd_2 (cost=0.43..14,740.05 rows=3,951 width=36) (actual rows= loops=)

  • Index Cond: (type = 'clinic'::text)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
168. 0.000 0.000 ↓ 0.0

Index Only Scan using contactview_metadata_uuid on contactview_metadata chwarea_1 (cost=0.43..1.28 rows=1 width=36) (actual rows= loops=)

  • Index Cond: (uuid = cmd_2.parent_uuid)
169. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_parent_uuid on contactview_metadata chw_1 (cost=0.43..0.59 rows=8 width=72) (actual rows= loops=)

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

Index Scan using pat_person_expr_idx8 on pat_person pat_person_1 (cost=0.42..0.61 rows=1 width=1,401) (actual rows= loops=)

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

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

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

Nested Loop (cost=1.53..3,494.00 rows=1 width=0) (actual rows= loops=)

173. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.11..2,206.70 rows=303 width=72) (actual rows= loops=)

174. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_chw on form_metadata meta_3 (cost=0.56..1,731.23 rows=303 width=36) (actual rows= loops=)

  • Index Cond: (chw = chp.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
175. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (uuid = meta_3.uuid)
176. 0.000 0.000 ↓ 0.0

Append (cost=0.42..4.13 rows=12 width=37) (actual rows= loops=)

177. 0.000 0.000 ↓ 0.0

Index Scan using pat_clinic_expr_idx8 on pat_clinic form_36 (cost=0.42..0.46 rows=1 width=1,032) (actual rows= loops=)

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

Index Scan using pat_form_postnatal_care_expr_idx8 on pat_form_postnatal_care form_37 (cost=0.42..0.45 rows=1 width=25) (actual rows= loops=)

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

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

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

Index Scan using pat_feedback_expr_idx8 on pat_feedback form_39 (cost=0.41..0.44 rows=1 width=654) (actual rows= loops=)

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

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

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

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

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

Index Scan using pat_info_expr_idx8 on pat_info form_42 (cost=0.56..0.65 rows=1 width=297) (actual rows= loops=)

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

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

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

Index Scan using pat_person_expr_idx8 on pat_person form_44 (cost=0.42..0.50 rows=1 width=1,401) (actual rows= loops=)

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

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

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

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 rows= loops=)

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

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

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

Nested Loop (cost=1.53..3,471.03 rows=125 width=36) (actual rows= loops=)

190. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.98..3,041.17 rows=690 width=73) (actual rows= loops=)

191. 0.000 0.000 ↓ 0.0

Append (cost=0.42..1,962.41 rows=690 width=37) (actual rows= loops=)

192. 0.000 0.000 ↓ 0.0

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_48 (cost=0.42..2.44 rows=1 width=1,032) (actual rows= loops=)

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

Index Scan using pat_form_postnatal_care_expr_expr1_idx1 on pat_form_postnatal_care form_49 (cost=0.42..1,935.78 rows=679 width=25) (actual rows= loops=)

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

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

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

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_51 (cost=0.29..2.31 rows=1 width=654) (actual rows= loops=)

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

Index Scan using pat_form_expr_idx9 on pat_form form_52 (cost=0.14..2.16 rows=1 width=638) (actual rows= loops=)

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

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_53 (cost=0.28..2.30 rows=1 width=957) (actual rows= loops=)

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

Index Scan using pat_info_expr_idx9 on pat_info form_54 (cost=0.43..2.46 rows=1 width=297) (actual rows= loops=)

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

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

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

Index Scan using pat_person_expr_idx9 on pat_person form_56 (cost=0.42..2.45 rows=1 width=1,401) (actual rows= loops=)

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

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_57 (cost=0.28..2.30 rows=1 width=828) (actual rows= loops=)

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

Index Scan using pat_usage_stats_expr_idx9 on pat_usage_stats form_58 (cost=0.14..2.16 rows=1 width=1,075) (actual rows= loops=)

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

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_59 (cost=0.28..2.31 rows=1 width=698) (actual rows= loops=)

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

Index Only Scan using form_metadata_uuid on form_metadata fm_1 (cost=0.56..1.56 rows=1 width=36) (actual rows= loops=)

  • Index Cond: (uuid = (form_48.doc ->> '_id'::text))
205. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_uuid on form_metadata meta_4 (cost=0.56..0.62 rows=1 width=72) (actual rows= loops=)

  • Index Cond: (uuid = fm_1.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
206. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=21,501.54..23,313.58 rows=2,164 width=48) (actual rows= loops=)

  • Group Key: useview_households_visited.chw, 0
207. 0.000 0.000 ↓ 0.0

Sort (cost=21,501.54..21,949.14 rows=179,040 width=76) (actual rows= loops=)

  • Sort Key: useview_households_visited.chw
208. 0.000 0.000 ↓ 0.0

Index Only Scan using households_date_visited_chw_hh on useview_households_visited (cost=0.57..5,880.37 rows=179,040 width=76) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
209. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=15,650.90..21,814.80 rows=2,204 width=152) (actual rows= loops=)

  • Group Key: population.chp_area_uuid, 0
210. 0.000 0.000 ↓ 0.0

Sort (cost=15,650.90..15,692.97 rows=16,827 width=86) (actual rows= loops=)

  • Sort Key: population.chp_area_uuid
211. 0.000 0.000 ↓ 0.0

Index Scan using useview_population_demographics_reported_idx on useview_population_demographics population (cost=0.44..14,469.78 rows=16,827 width=86) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
212. 0.000 0.000 ↓ 0.0

Materialize (cost=17,813.40..18,759.03 rows=2,146 width=64) (actual rows= loops=)

213. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=17,813.40..18,732.20 rows=2,146 width=64) (actual rows= loops=)

  • Group Key: survey.chw, 0
214. 0.000 0.000 ↓ 0.0

Sort (cost=17,813.40..17,913.10 rows=39,882 width=88) (actual rows= loops=)

  • Sort Key: survey.chw
215. 0.000 0.000 ↓ 0.0

Index Scan using useview_family_survey_uuid_reported_chw on useview_family_survey survey (cost=0.44..14,765.72 rows=39,882 width=88) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
216. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=30,957.12..34,708.24 rows=132,820 width=48) (actual rows= loops=)

  • Group Key: contactview_metadata_1.parent_uuid, 0
217. 0.000 0.000 ↓ 0.0

Sort (cost=30,957.12..31,562.85 rows=242,292 width=40) (actual rows= loops=)

  • Sort Key: contactview_metadata_1.parent_uuid
218. 0.000 0.000 ↓ 0.0

Index Scan using contactview_metadata_type on contactview_metadata contactview_metadata_1 (cost=0.43..9,288.48 rows=242,292 width=40) (actual rows= loops=)

  • Index Cond: (type = 'clinic'::text)
219. 0.000 0.000 ↓ 0.0

Materialize (cost=0.56..163,915.06 rows=2,435 width=48) (actual rows= loops=)

220. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.56..163,884.62 rows=2,435 width=48) (actual rows= loops=)

  • Group Key: useview_chp_sync.chw_uuid, 0
221. 0.000 0.000 ↓ 0.0

Index Only Scan using useview_chp_sync_chw_uuid_latest_replication_date on useview_chp_sync (cost=0.56..123,842.13 rows=5,332,505 width=48) (actual rows= loops=)

222. 0.000 0.000 ↓ 0.0

Materialize (cost=0.55..81,691.48 rows=2,205 width=48) (actual rows= loops=)

223. 0.000 0.000 ↓ 0.0

Subquery Scan on population_all_time (cost=0.55..81,680.46 rows=2,205 width=48) (actual rows= loops=)

224. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.55..81,658.40 rows=2,205 width=48) (actual rows= loops=)

  • Group Key: population_1.chp_area_uuid, 0
225. 0.000 0.000 ↓ 0.0

Index Scan using useview_population_demographics_chp_area_reported on useview_population_demographics population_1 (cost=0.55..74,305.42 rows=977,458 width=76) (actual rows= loops=)

226. 0.000 0.000 ↓ 0.0

Sort (cost=11.64..12.14 rows=200 width=52) (actual rows= loops=)

  • Sort Key: fp.chw_uuid, fp.interval_number
227. 0.000 0.000 ↓ 0.0

CTE Scan on fp (cost=0.00..4.00 rows=200 width=52) (actual rows= loops=)

228. 0.000 0.000 ↓ 0.0

Materialize (cost=40,030.47..40,050.47 rows=200 width=80) (actual rows= loops=)

229. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=40,030.47..40,047.97 rows=200 width=80) (actual rows= loops=)

  • Group Key: assess_u1fu_pnc_aggregated.chw, 0
230. 0.000 0.000 ↓ 0.0

Sort (cost=40,030.47..40,030.97 rows=200 width=96) (actual rows= loops=)

  • Sort Key: assess_u1fu_pnc_aggregated.chw
231. 0.000 0.000 ↓ 0.0

Subquery Scan on assess_u1fu_pnc_aggregated (cost=39,467.40..40,022.82 rows=200 width=96) (actual rows= loops=)

232. 0.000 0.000 ↓ 0.0

Unique (cost=39,467.40..40,020.82 rows=200 width=100) (actual rows= loops=)

233. 0.000 0.000 ↓ 0.0

Sort (cost=39,467.40..39,744.11 rows=110,684 width=100) (actual rows= loops=)

  • Sort Key: useview_assessment.patient_id, useview_assessment.reported DESC
234. 0.000 0.000 ↓ 0.0

Append (cost=0.44..30,194.25 rows=110,684 width=100) (actual rows= loops=)

235. 0.000 0.000 ↓ 0.0

Index Scan using useview_assessment_reported on useview_assessment (cost=0.44..20,393.19 rows=102,343 width=94) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
236. 0.000 0.000 ↓ 0.0

Index Scan using useview_u1_follow_up_reported_chw_uuid on useview_u1_follow_up (cost=0.30..744.95 rows=2,381 width=161) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
237. 0.000 0.000 ↓ 0.0

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_1 (cost=0.44..7,395.85 rows=5,960 width=185) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
  • Filter: is_date((date_of_birth)::character varying)
238. 0.000 0.000 ↓ 0.0

Materialize (cost=241.02..249.84 rows=133 width=56) (actual rows= loops=)

239. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=241.02..248.17 rows=133 width=56) (actual rows= loops=)

  • Group Key: dr.chw, 0
240. 0.000 0.000 ↓ 0.0

Sort (cost=241.02..241.36 rows=137 width=1,622) (actual rows= loops=)

  • Sort Key: dr.chw
241. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=52.82..236.16 rows=137 width=1,622) (actual rows= loops=)

  • Hash Cond: ((form.doc ->> '_id'::text) = dr.uuid)
242. 0.000 0.000 ↓ 0.0

Append (cost=0.42..181.96 rows=653 width=1,582) (actual rows= loops=)

243. 0.000 0.000 ↓ 0.0

Index Scan using pat_clinic_expr_idx9 on pat_clinic form (cost=0.42..2.44 rows=1 width=1,032) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
244. 0.000 0.000 ↓ 0.0

Seq Scan on pat_form_death_report form_1 (cost=0.00..155.63 rows=642 width=1,595) (actual rows= loops=)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
245. 0.000 0.000 ↓ 0.0

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
246. 0.000 0.000 ↓ 0.0

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_3 (cost=0.29..2.31 rows=1 width=654) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
247. 0.000 0.000 ↓ 0.0

Index Scan using pat_form_expr_idx9 on pat_form form_4 (cost=0.14..2.16 rows=1 width=638) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
248. 0.000 0.000 ↓ 0.0

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_5 (cost=0.28..2.30 rows=1 width=957) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
249. 0.000 0.000 ↓ 0.0

Index Scan using pat_info_expr_idx9 on pat_info form_6 (cost=0.43..2.45 rows=1 width=297) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
250. 0.000 0.000 ↓ 0.0

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
251. 0.000 0.000 ↓ 0.0

Index Scan using pat_person_expr_idx9 on pat_person form_8 (cost=0.42..2.44 rows=1 width=1,401) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
252. 0.000 0.000 ↓ 0.0

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_9 (cost=0.28..2.29 rows=1 width=828) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
253. 0.000 0.000 ↓ 0.0

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
254. 0.000 0.000 ↓ 0.0

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_11 (cost=0.28..2.30 rows=1 width=698) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
255. 0.000 0.000 ↓ 0.0

Hash (cost=50.69..50.69 rows=137 width=72) (actual rows= loops=)

256. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_formname on form_metadata dr (cost=0.43..50.69 rows=137 width=72) (actual rows= loops=)

  • Index Cond: (formname = 'death_report'::text)
  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
257. 0.000 0.000 ↓ 0.0

Materialize (cost=8,169.62..8,169.68 rows=2 width=48) (actual rows= loops=)

258. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=8,169.62..8,169.66 rows=2 width=48) (actual rows= loops=)

  • Group Key: "*SELECT* 1".chw_uuid, 0
259. 0.000 0.000 ↓ 0.0

Sort (cost=8,169.62..8,169.62 rows=2 width=40) (actual rows= loops=)

  • Sort Key: "*SELECT* 1".chw_uuid
260. 0.000 0.000 ↓ 0.0

Result (cost=7,939.42..8,169.61 rows=2 width=40) (actual rows= loops=)

261. 0.000 0.000 ↓ 0.0

Append (cost=7,939.42..8,169.59 rows=2 width=36) (actual rows= loops=)

262. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1 (cost=7,939.42..7,939.57 rows=1 width=36) (actual rows= loops=)

  • Filter: (("*SELECT* 1".reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND ("*SELECT* 1".reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
263. 0.000 0.000 ↓ 0.0

Unique (cost=7,939.42..7,939.44 rows=4 width=80) (actual rows= loops=)

264. 0.000 0.000 ↓ 0.0

Sort (cost=7,939.42..7,939.43 rows=4 width=80) (actual rows= loops=)

  • Sort Key: pv_2.patient_id
265. 0.000 0.000 ↓ 0.0

Hash Join (cost=226.91..7,939.38 rows=4 width=80) (actual rows= loops=)

  • Hash Cond: (pv_2.patient_id = (form_12.doc #>> '{fields,inputs,contact,_id}'::text[]))
266. 0.000 0.000 ↓ 0.0

Seq Scan on useview_pregnancy_visit pv_2 (cost=0.00..6,823.20 rows=177,846 width=36) (actual rows= loops=)

  • Filter: (patient_id <> ''::text)
267. 0.000 0.000 ↓ 0.0

Hash (cost=226.90..226.90 rows=1 width=1,626) (actual rows= loops=)

268. 0.000 0.000 ↓ 0.0

Hash Join (cost=43.56..226.90 rows=1 width=1,626) (actual rows= loops=)

  • Hash Cond: ((form_12.doc ->> '_id'::text) = dr_1.uuid)
269. 0.000 0.000 ↓ 0.0

Append (cost=0.42..181.96 rows=653 width=1,582) (actual rows= loops=)

270. 0.000 0.000 ↓ 0.0

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_12 (cost=0.42..2.44 rows=1 width=1,032) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
271. 0.000 0.000 ↓ 0.0

Seq Scan on pat_form_death_report form_13 (cost=0.00..155.63 rows=642 width=1,595) (actual rows= loops=)

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

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
273. 0.000 0.000 ↓ 0.0

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_15 (cost=0.29..2.31 rows=1 width=654) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
274. 0.000 0.000 ↓ 0.0

Index Scan using pat_form_expr_idx9 on pat_form form_16 (cost=0.14..2.16 rows=1 width=638) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
275. 0.000 0.000 ↓ 0.0

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_17 (cost=0.28..2.30 rows=1 width=957) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
276. 0.000 0.000 ↓ 0.0

Index Scan using pat_info_expr_idx9 on pat_info form_18 (cost=0.43..2.45 rows=1 width=297) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
277. 0.000 0.000 ↓ 0.0

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

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

Index Scan using pat_person_expr_idx9 on pat_person form_20 (cost=0.42..2.44 rows=1 width=1,401) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
279. 0.000 0.000 ↓ 0.0

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_21 (cost=0.28..2.29 rows=1 width=828) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
280. 0.000 0.000 ↓ 0.0

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

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

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_23 (cost=0.28..2.30 rows=1 width=698) (actual rows= loops=)

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

Hash (cost=33.70..33.70 rows=755 width=80) (actual rows= loops=)

283. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_formname on form_metadata dr_1 (cost=0.43..33.70 rows=755 width=80) (actual rows= loops=)

  • Index Cond: (formname = 'death_report'::text)
284. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2 (cost=229.97..230.01 rows=1 width=36) (actual rows= loops=)

  • Filter: (("*SELECT* 2".reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND ("*SELECT* 2".reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
285. 0.000 0.000 ↓ 0.0

Unique (cost=229.97..229.97 rows=1 width=80) (actual rows= loops=)

286. 0.000 0.000 ↓ 0.0

Sort (cost=229.97..229.97 rows=1 width=80) (actual rows= loops=)

  • Sort Key: pc_1.patient_id
287. 0.000 0.000 ↓ 0.0

Nested Loop (cost=43.98..229.96 rows=1 width=80) (actual rows= loops=)

288. 0.000 0.000 ↓ 0.0

Hash Join (cost=43.56..226.90 rows=1 width=1,626) (actual rows= loops=)

  • Hash Cond: ((form_24.doc ->> '_id'::text) = dr_2.uuid)
289. 0.000 0.000 ↓ 0.0

Append (cost=0.42..181.96 rows=653 width=1,582) (actual rows= loops=)

290. 0.000 0.000 ↓ 0.0

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_24 (cost=0.42..2.44 rows=1 width=1,032) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
291. 0.000 0.000 ↓ 0.0

Seq Scan on pat_form_death_report form_25 (cost=0.00..155.63 rows=642 width=1,595) (actual rows= loops=)

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
292. 0.000 0.000 ↓ 0.0

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
293. 0.000 0.000 ↓ 0.0

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_27 (cost=0.29..2.31 rows=1 width=654) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
294. 0.000 0.000 ↓ 0.0

Index Scan using pat_form_expr_idx9 on pat_form form_28 (cost=0.14..2.16 rows=1 width=638) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
295. 0.000 0.000 ↓ 0.0

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_29 (cost=0.28..2.30 rows=1 width=957) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
296. 0.000 0.000 ↓ 0.0

Index Scan using pat_info_expr_idx9 on pat_info form_30 (cost=0.43..2.45 rows=1 width=297) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
297. 0.000 0.000 ↓ 0.0

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

  • Filter: ((doc ->> 'form'::text) = 'death_report'::text)
298. 0.000 0.000 ↓ 0.0

Index Scan using pat_person_expr_idx9 on pat_person form_32 (cost=0.42..2.44 rows=1 width=1,401) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
299. 0.000 0.000 ↓ 0.0

Index Scan using pat_traffic_stats_expr_idx9 on pat_traffic_stats form_33 (cost=0.28..2.29 rows=1 width=828) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
300. 0.000 0.000 ↓ 0.0

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
301. 0.000 0.000 ↓ 0.0

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_35 (cost=0.28..2.30 rows=1 width=698) (actual rows= loops=)

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
302. 0.000 0.000 ↓ 0.0

Hash (cost=33.70..33.70 rows=755 width=80) (actual rows= loops=)

303. 0.000 0.000 ↓ 0.0

Index Scan using form_metadata_formname on form_metadata dr_2 (cost=0.43..33.70 rows=755 width=80) (actual rows= loops=)

  • Index Cond: (formname = 'death_report'::text)
304. 0.000 0.000 ↓ 0.0

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pc_1 (cost=0.42..3.05 rows=1 width=36) (actual rows= loops=)

  • 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))
305. 0.000 0.000 ↓ 0.0

Materialize (cost=57,217.02..61,740.72 rows=1,800 width=48) (actual rows= loops=)

306. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=57,217.02..61,718.22 rows=1,800 width=48) (actual rows= loops=)

  • Group Key: useview_home_visit.reported_by, 0
307. 0.000 0.000 ↓ 0.0

Sort (cost=57,217.02..58,337.82 rows=448,320 width=76) (actual rows= loops=)

  • Sort Key: useview_home_visit.reported_by
308. 0.000 0.000 ↓ 0.0

Index Only Scan using index_useview_home_visit_reported_family_uuid_reported_by on useview_home_visit (cost=0.45..15,132.84 rows=448,320 width=76) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
309. 0.000 0.000 ↓ 0.0

Materialize (cost=7,327.84..10,078.52 rows=200 width=97) (actual rows= loops=)

310. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=7,327.84..10,076.02 rows=200 width=97) (actual rows= loops=)

  • Group Key: "*SELECT* 1_1".reported_by, 0
311. 0.000 0.000 ↓ 0.0

Sort (cost=7,327.84..7,489.38 rows=64,616 width=178) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_1".reported_by
312. 0.000 0.000 ↓ 0.0

Merge Right Join (cost=1,184.28..2,165.15 rows=64,616 width=178) (actual rows= loops=)

  • Merge Cond: (useview_fp_follow_up_prospective_ke.source_id = "*SELECT* 1_1".form_uuid)
313. 0.000 0.000 ↓ 0.0

Sort (cost=222.96..228.77 rows=2,326 width=89) (actual rows= loops=)

  • Sort Key: useview_fp_follow_up_prospective_ke.source_id
314. 0.000 0.000 ↓ 0.0

Append (cost=0.00..92.89 rows=2,326 width=89) (actual rows= loops=)

315. 0.000 0.000 ↓ 0.0

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

316. 0.000 0.000 ↓ 0.0

Seq Scan on useview_fp_follow_up_short_term_ke (cost=0.00..23.83 rows=683 width=89) (actual rows= loops=)

317. 0.000 0.000 ↓ 0.0

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

318. 0.000 0.000 ↓ 0.0

Sort (cost=961.33..975.22 rows=5,556 width=122) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_1".form_uuid
319. 0.000 0.000 ↓ 0.0

Append (cost=0.29..615.75 rows=5,556 width=122) (actual rows= loops=)

320. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_1 (cost=0.29..136.52 rows=1,089 width=122) (actual rows= loops=)

321. 0.000 0.000 ↓ 0.0

Result (cost=0.29..125.63 rows=1,089 width=122) (actual rows= loops=)

322. 0.000 0.000 ↓ 0.0

Append (cost=0.29..114.74 rows=1,089 width=121) (actual rows= loops=)

323. 0.000 0.000 ↓ 0.0

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.29..38.67 rows=405 width=121) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
324. 0.000 0.000 ↓ 0.0

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.29..29.45 rows=368 width=121) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
325. 0.000 0.000 ↓ 0.0

Seq Scan on useview_fp_follow_up_long_term_ke useview_fp_follow_up_long_term_ke_1 (cost=0.00..41.17 rows=316 width=121) (actual rows= loops=)

  • Filter: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))
326. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2_1 (cost=0.30..451.45 rows=4,467 width=122) (actual rows= loops=)

327. 0.000 0.000 ↓ 0.0

Index Scan using index_useview_fp_registration_ke_reported_patient_id_uuid on useview_fp_registration_ke (cost=0.30..406.78 rows=4,467 width=122) (actual rows= loops=)

  • Index Cond: ((reported >= (date_trunc('day'::text, ('2019-08-01'::date)::timestamp with time zone))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, ('2019-11-01'::date)::timestamp with time zone) + '1 day'::interval))::timestamp without time zone))