explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9J6b

Settings
# exclusive inclusive rows x rows loops node
1. 64.411 331,538.151 ↓ 1,842.0 1,842 1

GroupAggregate (cost=3,494,962.71..3,494,964.26 rows=1 width=650) (actual time=331,473.620..331,538.151 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, chwlist.interval_number, (date(chwlist.interval_start))
  • Functions: 914
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 139.816 ms, Inlining 56.276 ms, Optimization 9677.793 ms, Emission 6793.022 ms, Total 16666.907 ms
2.          

CTE fp

3. 10.194 390.179 ↓ 8.1 1,619 1

GroupAggregate (cost=10,231.93..10,575.13 rows=200 width=56) (actual time=378.066..390.179 rows=1,619 loops=1)

  • Group Key: "*SELECT* 1_2".reported_by, 0
4. 31.618 379.985 ↑ 1.0 19,051 1

Sort (cost=10,231.93..10,280.53 rows=19,440 width=80) (actual time=378.011..379.985 rows=19,051 loops=1)

  • Sort Key: "*SELECT* 1_2".reported_by
  • Sort Method: quicksort Memory: 3448kB
5. 3.632 348.367 ↑ 1.0 19,051 1

Result (cost=0.00..8,847.14 rows=19,440 width=80) (actual time=0.878..348.367 rows=19,051 loops=1)

6. 2.721 344.735 ↑ 1.0 19,051 1

Append (cost=0.00..8,652.74 rows=19,440 width=76) (actual time=0.875..344.735 rows=19,051 loops=1)

7. 0.041 7.789 ↑ 1.1 150 1

Subquery Scan on *SELECT* 1_2 (cost=0.00..380.50 rows=158 width=78) (actual time=0.873..7.789 rows=150 loops=1)

8. 7.748 7.748 ↑ 1.1 150 1

Seq Scan on useview_fp_registration (cost=0.00..378.93 rows=158 width=256) (actual time=0.860..7.748 rows=150 loops=1)

  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 4712
9. 0.172 16.059 ↑ 1.0 1,012 1

Subquery Scan on *SELECT* 2_2 (cost=0.44..690.50 rows=1,044 width=78) (actual time=0.085..16.059 rows=1,012 loops=1)

10. 15.887 15.887 ↑ 1.0 1,012 1

Index Scan using index_useview_person_fp_registration_reported_chw_patient_id on useview_person_fp_registration (cost=0.44..680.06 rows=1,044 width=256) (actual time=0.083..15.887 rows=1,012 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 182
11. 3.138 318.166 ↑ 1.0 17,889 1

Subquery Scan on *SELECT* 3 (cost=0.45..7,484.54 rows=18,238 width=76) (actual time=0.100..318.166 rows=17,889 loops=1)

12. 315.028 315.028 ↑ 1.0 17,889 1

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_2 (cost=0.45..7,302.16 rows=18,238 width=254) (actual time=0.098..315.028 rows=17,889 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
13. 12.962 331,473.740 ↓ 921.0 1,842 1

Sort (cost=3,484,387.58..3,484,387.59 rows=2 width=1,986) (actual time=331,473.485..331,473.740 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, chwlist.interval_number, (date(chwlist.interval_start))
  • Sort Method: quicksort Memory: 1819kB
14. 1.984 331,460.778 ↓ 921.0 1,842 1

Hash Left Join (cost=3,402,686.17..3,484,387.57 rows=2 width=1,986) (actual time=330,344.262..331,460.778 rows=1,842 loops=1)

  • Hash Cond: ((chwlist.chw_uuid = fp_fu_ke.chw_uuid) AND (chwlist.interval_number = fp_fu_ke.interval_number))
15. 1.478 331,425.055 ↓ 921.0 1,842 1

Hash Left Join (cost=3,392,525.81..3,474,227.20 rows=2 width=1,934) (actual time=330,310.508..331,425.055 rows=1,842 loops=1)

  • Hash Cond: ((chwlist.chw_uuid = infant_deaths.chw_uuid) AND (chwlist.interval_number = infant_deaths.interval_number))
16. 2.105 331,402.363 ↓ 921.0 1,842 1

Hash Left Join (cost=3,392,265.86..3,473,967.24 rows=2 width=1,918) (actual time=330,289.278..331,402.363 rows=1,842 loops=1)

  • Hash Cond: ((chwlist.chw_uuid = fp.chw_uuid) AND (chwlist.interval_number = fp.interval_number))
17. 1.958 331,008.884 ↓ 921.0 1,842 1

Hash Left Join (cost=3,392,258.86..3,473,960.12 rows=2 width=1,902) (actual time=329,897.874..331,008.884 rows=1,842 loops=1)

  • Hash Cond: ((chwlist.chw_uuid = sync.chw_uuid) AND (chwlist.interval_number = sync.interval_number))
18. 4.606 328,646.331 ↓ 921.0 1,842 1

Hash Right Join (cost=3,222,935.75..3,304,636.99 rows=2 width=1,894) (actual time=327,537.257..328,646.331 rows=1,842 loops=1)

  • Hash Cond: ((population.chp_area_uuid = chwlist.chw_area_uuid) AND ((0) = chwlist.interval_number))
19. 133.733 1,105.079 ↓ 1.0 2,222 1

GroupAggregate (cost=0.55..81,658.16 rows=2,181 width=48) (actual time=0.593..1,105.079 rows=2,222 loops=1)

  • Group Key: population.chp_area_uuid, 0
20. 971.346 971.346 ↑ 1.0 977,458 1

Index Scan using useview_population_demographics_chp_area_reported on useview_population_demographics population (cost=0.55..74,305.42 rows=977,458 width=77) (actual time=0.057..971.346 rows=977,458 loops=1)

21. 10.264 327,536.646 ↓ 921.0 1,842 1

Hash (cost=3,222,935.17..3,222,935.17 rows=2 width=1,922) (actual time=327,536.646..327,536.646 rows=1,842 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 1345kB
22. 6.140 327,526.382 ↓ 921.0 1,842 1

Merge Left Join (cost=3,206,880.51..3,222,935.17 rows=2 width=1,922) (actual time=22,612.952..327,526.382 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = useview_home_visit.reported_by)
  • Join Filter: (chwlist.interval_number = (0))
23. 3.863 325,704.989 ↓ 921.0 1,842 1

Merge Left Join (cost=3,129,056.46..3,140,626.97 rows=2 width=1,914) (actual time=21,333.693..325,704.989 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = "*SELECT* 1".chw_uuid)
  • Join Filter: (chwlist.interval_number = (0))
24. 7.820 325,600.982 ↓ 921.0 1,842 1

Merge Left Join (cost=3,120,880.73..3,132,451.13 rows=2 width=1,906) (actual time=21,233.579..325,600.982 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess_u1fu_pnc_aggregated.chw)
  • Join Filter: (chwlist.interval_number = (0))
25. 180.682 324,551.649 ↓ 921.0 1,842 1

Nested Loop Left Join (cost=3,080,300.93..3,091,850.80 rows=2 width=1,866) (actual time=20,370.216..324,551.649 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_area_uuid = contactview_metadata_1.parent_uuid) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 2066260
26. 9.049 323,238.137 ↓ 1,842.0 1,842 1

Merge Left Join (cost=3,069,006.25..3,077,751.26 rows=1 width=1,822) (actual time=20,237.475..323,238.137 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = survey.chw)
  • Join Filter: (chwlist.interval_number = (0))
27. 273.652 323,040.704 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=3,050,944.85..3,058,719.36 rows=1 width=1,798) (actual time=20,149.073..323,040.704 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_area_uuid = population_1.chp_area_uuid) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 3057939
28. 359.248 321,300.820 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=3,028,918.43..3,036,594.80 rows=1 width=1,686) (actual time=20,065.358..321,300.820 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = useview_households_visited.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 3208918
29. 18.826 34,735.296 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=2,980,888.88..2,986,639.19 rows=1 width=1,678) (actual time=19,661.083..34,735.296 rows=1,842 loops=1)

  • Join Filter: (chwlist.interval_number = 0)
30. 117.832 31,417.448 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=2,980,888.60..2,983,080.37 rows=1 width=1,674) (actual time=19,660.465..31,417.448 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = meta.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 1307083
31. 9.640 30,916.480 ↓ 1,842.0 1,842 1

Merge Left Join (cost=2,976,668.76..2,978,783.11 rows=1 width=1,666) (actual time=19,605.912..30,916.480 rows=1,842 loops=1)

  • Merge Cond: (chwlist.chw_uuid = assess.chw)
  • Join Filter: (chwlist.interval_number = (0))
32. 336.352 30,642.952 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=2,935,229.78..2,937,257.87 rows=1 width=1,658) (actual time=19,354.047..30,642.952 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = chwview_assessment.chw_uuid) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 3170240
33. 87.291 19,939.824 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=2,902,810.51..2,904,528.11 rows=1 width=406) (actual time=19,141.437..19,939.824 rows=1,842 loops=1)

  • Join Filter: ((chwlist.chw_uuid = p.chw) AND (chwlist.interval_number = (0)))
  • Rows Removed by Join Filter: 918761
34. 123.988 19,189.413 ↓ 1,842.0 1,842 1

Nested Loop Left Join (cost=2,869,317.61..2,871,028.21 rows=1 width=398) (actual time=18,680.920..19,189.413 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: 1384689
35. 10.067 18,453.881 ↓ 1,842.0 1,842 1

Merge Left Join (cost=2,851,825.26..2,853,401.53 rows=1 width=390) (actual time=18,434.264..18,453.881 rows=1,842 loops=1)

  • Merge Cond: ((chwlist.chw_uuid = anc_pnc_u1fu.chw_uuid) AND (chwlist.interval_number = anc_pnc_u1fu.interval_number))
36. 5.379 16,649.554 ↓ 1,842.0 1,842 1

Sort (cost=13,674.89..13,674.89 rows=1 width=342) (actual time=16,647.891..16,649.554 rows=1,842 loops=1)

  • Sort Key: chwlist.chw_uuid, chwlist.interval_number
  • Sort Method: quicksort Memory: 943kB
37. 0.761 16,644.175 ↓ 1,842.0 1,842 1

Hash Right Join (cost=13,622.67..13,674.88 rows=1 width=342) (actual time=16,643.085..16,644.175 rows=1,842 loops=1)

  • Hash Cond: ((useview_pregnancy.chw = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
38. 2.281 5.638 ↑ 1.3 1,466 1

HashAggregate (cost=851.38..870.36 rows=1,898 width=56) (actual time=5.298..5.638 rows=1,466 loops=1)

  • Group Key: useview_pregnancy.chw, 0
39. 3.357 3.357 ↑ 1.0 4,381 1

Index Scan using useview_pregnancy_reported on useview_pregnancy (cost=0.32..762.34 rows=4,452 width=79) (actual time=0.061..3.357 rows=4,381 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
40. 1.202 16,637.776 ↓ 1,842.0 1,842 1

Hash (cost=12,771.27..12,771.27 rows=1 width=326) (actual time=16,637.776..16,637.776 rows=1,842 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 633kB
41. 0.897 16,636.574 ↓ 1,842.0 1,842 1

Hash Right Join (cost=12,713.79..12,771.27 rows=1 width=326) (actual time=16,635.328..16,636.574 rows=1,842 loops=1)

  • Hash Cond: ((anc.chw = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
42. 5.317 38.742 ↑ 1.3 1,606 1

HashAggregate (cost=8,986.61..9,007.51 rows=2,090 width=48) (actual time=38.379..38.742 rows=1,606 loops=1)

  • Group Key: anc.chw, 0
43. 33.425 33.425 ↑ 1.0 16,337 1

Index Scan using useview_pregnancy_visit_pregnancy_reported_uuid on useview_pregnancy_visit anc (cost=0.45..8,860.69 rows=16,789 width=40) (actual time=3.045..33.425 rows=16,337 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::interval)))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
44. 1.174 16,596.935 ↓ 1,842.0 1,842 1

Hash (cost=3,727.17..3,727.17 rows=1 width=318) (actual time=16,596.935..16,596.935 rows=1,842 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 619kB
45. 0.823 16,595.761 ↓ 1,842.0 1,842 1

Hash Right Join (cost=3,673.01..3,727.17 rows=1 width=318) (actual time=16,594.271..16,595.761 rows=1,842 loops=1)

  • Hash Cond: ((pnc.chw = chwlist.chw_uuid) AND ((0) = chwlist.interval_number))
46. 12.032 26.467 ↑ 1.3 1,486 1

HashAggregate (cost=3,465.04..3,484.73 rows=1,969 width=136) (actual time=25.787..26.467 rows=1,486 loops=1)

  • Group Key: pnc.chw, 0
47. 14.435 14.435 ↑ 1.4 4,717 1

Index Scan using useview_postnatal_reported on useview_postnatal_care pnc (cost=0.45..2,697.06 rows=6,536 width=102) (actual time=0.153..14.435 rows=4,717 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 13172
48. 0.912 16,568.471 ↓ 1,842.0 1,842 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 469kB
49. 0.250 16,567.559 ↓ 1,842.0 1,842 1

Subquery Scan on chwlist (cost=190.12..207.96 rows=1 width=222) (actual time=16,557.113..16,567.559 rows=1,842 loops=1)

50. 1.887 16,567.309 ↓ 1,842.0 1,842 1

Nested Loop Anti Join (cost=190.12..207.95 rows=1 width=222) (actual time=16,557.111..16,567.309 rows=1,842 loops=1)

51. 3.037 16,560.730 ↓ 156.4 2,346 1

Group (cost=189.85..190.26 rows=15 width=222) (actual time=16,557.080..16,560.730 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()) - '3 mons'::interval))), (0)
52. 29.287 16,557.693 ↓ 469.2 7,038 1

Sort (cost=189.85..189.88 rows=15 width=222) (actual time=16,557.072..16,557.693 rows=7,038 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()) - '3 mons'::interval))), (0)
  • Sort Method: quicksort Memory: 2062kB
53. 1.069 16,528.406 ↓ 469.2 7,038 1

Hash Join (cost=148.15..189.55 rows=15 width=222) (actual time=16,527.349..16,528.406 rows=7,038 loops=1)

  • Hash Cond: ((row_number() OVER (?)) = (row_number() OVER (?)))
54. 0.016 16,501.739 ↑ 333.3 3 1

WindowAgg (cost=59.85..87.35 rows=1,000 width=24) (actual time=16,501.731..16,501.739 rows=3 loops=1)

55. 0.007 16,501.723 ↑ 333.3 3 1

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

  • Sort Key: generate_series.generate_series
  • Sort Method: quicksort Memory: 25kB
56. 16,501.716 16,501.716 ↑ 333.3 3 1

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

57. 3.025 25.598 ↓ 2,346.0 7,038 1

Hash (cost=88.27..88.27 rows=3 width=222) (actual time=25.597..25.598 rows=7,038 loops=1)

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 1792kB
58. 1.960 22.573 ↓ 2,346.0 7,038 1

Nested Loop (cost=1.24..88.27 rows=3 width=222) (actual time=0.096..22.573 rows=7,038 loops=1)

59. 2.307 15.921 ↓ 2,346.0 2,346 1

Nested Loop (cost=1.14..88.05 rows=1 width=210) (actual time=0.073..15.921 rows=2,346 loops=1)

60. 0.578 1.884 ↓ 2,346.0 2,346 1

Nested Loop (cost=0.71..85.78 rows=1 width=193) (actual time=0.058..1.884 rows=2,346 loops=1)

61. 0.045 0.045 ↓ 13.0 13 1

Index Scan using contactview_metadata_type on contactview_metadata cmd (cost=0.43..2.45 rows=1 width=54) (actual time=0.038..0.045 rows=13 loops=1)

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

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

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

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

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

WindowAgg (cost=0.11..0.16 rows=3 width=16) (actual time=0.001..0.002 rows=3 loops=2,346)

65. 0.000 0.000 ↑ 1.0 3 2,346

Sort (cost=0.11..0.11 rows=3 width=4) (actual time=0.000..0.000 rows=3 loops=2,346)

  • Sort Key: generate_series_1.generate_series
  • Sort Method: quicksort Memory: 25kB
66. 0.012 0.012 ↑ 1.0 3 1

Function Scan on generate_series generate_series_1 (cost=0.05..0.08 rows=3 width=4) (actual time=0.012..0.012 rows=3 loops=1)

67. 4.692 4.692 ↓ 0.0 0 2,346

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

  • Index Cond: (chw = chp_1.uuid)
  • Heap Fetches: 504
68. 6.538 1,794.260 ↑ 3.5 1,293 1

GroupAggregate (cost=2,838,150.37..2,839,659.54 rows=4,472 width=88) (actual time=1,786.351..1,794.260 rows=1,293 loops=1)

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

CTE u1s

70. 5.780 27.138 ↓ 1.2 7,063 1

HashAggregate (cost=15,772.22..15,832.79 rows=6,057 width=82) (actual time=25.335..27.138 rows=7,063 loops=1)

  • Group Key: useview_population_demographics.family_uuid, useview_population_demographics.uuid, useview_population_demographics.date_of_birth, 0
71. 21.358 21.358 ↓ 1.2 7,063 1

Index Scan using useview_population_demographics_reported_idx on useview_population_demographics (cost=0.45..15,711.65 rows=6,057 width=82) (actual time=0.048..21.358 rows=7,063 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 10038
72. 2.511 1,787.722 ↑ 13.8 3,246 1

Sort (cost=2,822,317.59..2,822,429.38 rows=44,716 width=64) (actual time=1,786.330..1,787.722 rows=3,246 loops=1)

  • Sort Key: anc_pnc_u1fu.chw_uuid, anc_pnc_u1fu.interval_number
  • Sort Method: quicksort Memory: 553kB
73. 0.457 1,785.211 ↑ 13.8 3,246 1

Subquery Scan on anc_pnc_u1fu (cost=2,603,045.09..2,818,863.61 rows=44,716 width=64) (actual time=1,744.207..1,785.211 rows=3,246 loops=1)

74. 37.201 1,784.754 ↑ 13.8 3,246 1

GroupAggregate (cost=2,603,045.09..2,818,416.45 rows=44,716 width=100) (actual time=1,744.204..1,784.754 rows=3,246 loops=1)

  • Group Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
75. 50.582 1,747.553 ↑ 376.6 32,613 1

Sort (cost=2,603,045.09..2,633,748.55 rows=12,281,383 width=183) (actual time=1,744.141..1,747.553 rows=32,613 loops=1)

  • Sort Key: pmb.chw_uuid, pmb.baby_uuid, pmb.interval_number
  • Sort Method: quicksort Memory: 9431kB
76. 7.609 1,696.971 ↑ 376.6 32,613 1

Hash Left Join (cost=235,783.87..533,250.10 rows=12,281,383 width=183) (actual time=1,472.665..1,696.971 rows=32,613 loops=1)

  • Hash Cond: (pmb.baby_uuid = u1fu.patient_id)
77. 41.813 1,680.973 ↑ 154.8 32,613 1

Merge Right Join (cost=234,564.39..352,413.67 rows=5,049,167 width=146) (actual time=1,464.234..1,680.973 rows=32,613 loops=1)

  • Merge Cond: (pc.patient_id = pmb.mother_uuid)
78. 105.185 105.185 ↑ 1.0 135,743 1

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pc (cost=0.42..8,825.82 rows=135,760 width=73) (actual time=0.018..105.185 rows=135,743 loops=1)

79. 6.848 1,533.975 ↑ 62.8 32,611 1

Materialize (cost=234,563.97..272,629.47 rows=2,047,412 width=145) (actual time=1,463.835..1,533.975 rows=32,611 loops=1)

80. 30.625 1,527.127 ↑ 172.7 11,856 1

Merge Left Join (cost=234,563.97..267,510.94 rows=2,047,412 width=145) (actual time=1,463.831..1,527.127 rows=11,856 loops=1)

  • Merge Cond: (pmb.mother_uuid = pv.patient_id)
81. 5.922 991.344 ↑ 137.8 3,246 1

Sort (cost=212,670.37..213,788.27 rows=447,158 width=108) (actual time=990.712..991.344 rows=3,246 loops=1)

  • Sort Key: pmb.mother_uuid
  • Sort Method: quicksort Memory: 959kB
82. 0.405 985.422 ↑ 137.8 3,246 1

Subquery Scan on pmb (cost=143,558.80..155,855.65 rows=447,158 width=108) (actual time=981.882..985.422 rows=3,246 loops=1)

83. 2.509 985.017 ↑ 137.8 3,246 1

Group (cost=143,558.80..151,384.07 rows=447,158 width=176) (actual time=981.880..985.017 rows=3,246 loops=1)

  • Group Key: pnc_1.chw, u1s.family_uuid, (string_agg(DISTINCT pd.uuid, ','::text)), pnc_1.patient_id, u1s.uuid, u1s.interval_number
84. 17.755 982.508 ↑ 54.2 8,256 1

Sort (cost=143,558.80..144,676.70 rows=447,158 width=172) (actual time=981.863..982.508 rows=8,256 loops=1)

  • Sort Key: pnc_1.chw, u1s.family_uuid, (string_agg(DISTINCT pd.uuid, ','::text)), u1s.uuid, u1s.interval_number
  • Sort Method: quicksort Memory: 2578kB
85. 5.762 964.753 ↑ 54.2 8,256 1

Merge Join (cost=63,216.44..79,758.07 rows=447,158 width=172) (actual time=888.644..964.753 rows=8,256 loops=1)

  • Merge Cond: (u1s.family_uuid = pd.family_uuid)
86. 13.530 43.409 ↓ 1.2 7,063 1

Sort (cost=501.65..516.79 rows=6,057 width=68) (actual time=42.061..43.409 rows=7,063 loops=1)

  • Sort Key: u1s.family_uuid
  • Sort Method: quicksort Memory: 1186kB
87. 29.879 29.879 ↓ 1.2 7,063 1

CTE Scan on u1s (cost=0.00..121.14 rows=6,057 width=68) (actual time=25.340..29.879 rows=7,063 loops=1)

88. 3.403 915.582 ↑ 1.8 8,256 1

Materialize (cost=62,714.79..72,555.68 rows=14,765 width=141) (actual time=846.566..915.582 rows=8,256 loops=1)

89. 0.716 912.179 ↑ 2.0 7,416 1

Nested Loop (cost=62,714.79..72,518.76 rows=14,765 width=141) (actual time=846.563..912.179 rows=7,416 loops=1)

90. 19.992 868.259 ↓ 1.0 6,172 1

GroupAggregate (cost=62,714.37..62,834.11 rows=5,987 width=69) (actual time=846.533..868.259 rows=6,172 loops=1)

  • Group Key: pd.family_uuid
91. 18.666 848.267 ↓ 1.8 10,862 1

Sort (cost=62,714.37..62,729.34 rows=5,987 width=74) (actual time=846.494..848.267 rows=10,862 loops=1)

  • Sort Key: pd.family_uuid
  • Sort Method: quicksort Memory: 1912kB
92. 5.218 829.601 ↓ 1.8 10,862 1

Hash Join (cost=62,104.75..62,338.76 rows=5,987 width=74) (actual time=823.558..829.601 rows=10,862 loops=1)

  • Hash Cond: (u1s_1.family_uuid = pd.family_uuid)
93. 0.986 0.986 ↓ 1.2 7,063 1

CTE Scan on u1s u1s_1 (cost=0.00..121.14 rows=6,057 width=32) (actual time=0.001..0.986 rows=7,063 loops=1)

94. 114.152 823.397 ↓ 1.8 314,130 1

Hash (cost=59,891.76..59,891.76 rows=177,039 width=74) (actual time=823.397..823.397 rows=314,130 loops=1)

  • Buckets: 524288 (originally 262144) Batches: 1 (originally 1) Memory Usage: 36614kB
95. 709.245 709.245 ↓ 1.8 314,130 1

Index Scan using useview_population_demographics_sex_date_of_birth_idx on useview_population_demographics pd (cost=0.42..59,891.76 rows=177,039 width=74) (actual time=0.031..709.245 rows=314,130 loops=1)

  • Index Cond: (sex = 'female'::text)
  • Filter: ((date_part('years'::text, age(now(), (date_of_birth)::timestamp with time zone)))::integer >= 15)
  • Rows Removed by Filter: 219593
96. 43.204 43.204 ↑ 2.0 1 6,172

Index Scan using useview_postnatal_patient_id on useview_postnatal_care pnc_1 (cost=0.42..1.59 rows=2 width=72) (actual time=0.006..0.007 rows=1 loops=6,172)

  • Index Cond: (patient_id = (string_agg(DISTINCT pd.uuid, ','::text)))
97. 469.002 505.158 ↓ 1.0 178,909 1

Sort (cost=21,893.60..22,338.40 rows=177,920 width=73) (actual time=473.005..505.158 rows=178,909 loops=1)

  • Sort Key: pv.patient_id
  • Sort Method: quicksort Memory: 31161kB
98. 36.156 36.156 ↓ 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.013..36.156 rows=177,936 loops=1)

99. 4.198 8.389 ↑ 1.0 17,710 1

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

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

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

101. 366.086 611.544 ↑ 5.1 752 1,842

HashAggregate (cost=17,492.35..17,530.73 rows=3,838 width=48) (actual time=0.135..0.332 rows=752 loops=1,842)

  • Group Key: contactview_metadata.parent_uuid, 0
102. 245.458 245.458 ↑ 1.3 2,994 1

Index Scan using contactview_metadata_type on contactview_metadata (cost=0.43..17,462.93 rows=3,923 width=77) (actual time=0.162..245.458 rows=2,994 loops=1)

  • Index Cond: (type = 'clinic'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 236518
103. 203.138 663.120 ↓ 2.5 499 1,842

HashAggregate (cost=33,492.89..33,494.89 rows=200 width=48) (actual time=0.251..0.360 rows=499 loops=1,842)

  • Group Key: p.chw, 0
104. 1.257 459.982 ↑ 113.5 821 1

Hash Left Join (cost=32,174.46..32,794.26 rows=93,151 width=76) (actual time=442.005..459.982 rows=821 loops=1)

  • Hash Cond: (p.patient_id = useview_postnatal_care.patient_id)
  • Filter: (((max(useview_postnatal_care.reported)) IS NULL) OR ((@ ((CASE WHEN (max(pv_1.new_edd) <> ''::text) THEN (max(pv_1.new_edd))::date ELSE max(p.edd) END) - ((max(useview_postnatal_care.reported)))::date)) > 60))
  • Rows Removed by Filter: 1591
105. 23.613 381.806 ↓ 1.6 2,412 1

HashAggregate (cost=24,340.15..24,940.71 rows=1,511 width=76) (actual time=364.866..381.806 rows=2,412 loops=1)

  • Group Key: p.chw, p.patient_id
  • Filter: ((max(p.edd) >= date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 9010
106. 5.667 358.193 ↓ 1.4 12,460 1

Hash Anti Join (cost=21,008.48..24,158.85 rows=9,065 width=78) (actual time=324.797..358.193 rows=12,460 loops=1)

  • Hash Cond: (p.patient_id = upv.patient_id)
107. 19.672 300.251 ↓ 1.7 19,879 1

Hash Join (cost=16,050.43..19,077.25 rows=11,493 width=78) (actual time=272.459..300.251 rows=19,879 loops=1)

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

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

109. 4.171 272.403 ↑ 1.7 18,234 1

Hash (cost=15,657.34..15,657.34 rows=31,447 width=46) (actual time=272.403..272.403 rows=18,234 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1721kB
110. 2.936 268.232 ↑ 1.7 18,234 1

Subquery Scan on pv_1 (cost=15,072.76..15,657.34 rows=31,447 width=46) (actual time=250.763..268.232 rows=18,234 loops=1)

111. 7.760 265.296 ↑ 1.7 18,234 1

Unique (cost=15,072.76..15,342.87 rows=31,447 width=47) (actual time=250.740..265.296 rows=18,234 loops=1)

112. 133.184 257.536 ↑ 1.1 51,316 1

Sort (cost=15,072.76..15,207.81 rows=54,023 width=47) (actual time=250.738..257.536 rows=51,316 loops=1)

  • Sort Key: useview_pregnancy_visit.patient_id, useview_pregnancy_visit.reported DESC
  • Sort Method: quicksort Memory: 8711kB
113. 124.352 124.352 ↑ 1.1 51,316 1

Seq Scan on useview_pregnancy_visit (cost=0.00..10,826.20 rows=54,023 width=47) (actual time=40.878..124.352 rows=51,316 loops=1)

  • Filter: (((edd_updated IS TRUE) AND (reported > ((date_trunc('month'::text, now()) - '3 mons'::interval) - '9 mons'::interval))) OR (reported > ((date_trunc('month'::text, now()) - '1 day'::interval) - '9 mons'::interval)))
  • Rows Removed by Filter: 126620
114. 1.778 52.275 ↑ 1.5 7,938 1

Hash (cost=4,811.93..4,811.93 rows=11,690 width=36) (actual time=52.275..52.275 rows=7,938 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 663kB
115. 1.006 50.497 ↑ 1.5 7,938 1

Subquery Scan on upv (cost=4,628.14..4,811.93 rows=11,690 width=36) (actual time=46.903..50.497 rows=7,938 loops=1)

116. 1.822 49.491 ↑ 1.5 7,938 1

Unique (cost=4,628.14..4,695.03 rows=11,690 width=44) (actual time=46.894..49.491 rows=7,938 loops=1)

117. 19.024 47.669 ↑ 1.4 9,852 1

Sort (cost=4,628.14..4,661.59 rows=13,377 width=44) (actual time=46.892..47.669 rows=9,852 loops=1)

  • Sort Key: useview_pregnancy_visit_1.patient_id, useview_pregnancy_visit_1.reported DESC
  • Sort Method: quicksort Memory: 1154kB
118. 28.645 28.645 ↑ 1.4 9,852 1

Index Scan using useview_pregnancy_visit_continue_follow_up on useview_pregnancy_visit useview_pregnancy_visit_1 (cost=0.42..3,711.32 rows=13,377 width=44) (actual time=8.909..28.645 rows=9,852 loops=1)

  • Index Cond: (continue_follow_up = false)
  • Filter: ((reported > ((date_trunc('month'::text, now()) - '3 mons'::interval) - '9 mons'::interval)) OR (reported > ((date_trunc('month'::text, now()) - '1 day'::interval) - '9 mons'::interval)))
  • Rows Removed by Filter: 15950
119. 10.108 76.919 ↓ 1.2 43,086 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 3879kB
120. 32.565 66.811 ↓ 1.2 43,086 1

HashAggregate (cost=6,644.06..7,010.29 rows=36,623 width=44) (actual time=57.211..66.811 rows=43,086 loops=1)

  • Group Key: useview_postnatal_care.patient_id
121. 34.246 34.246 ↑ 1.0 48,409 1

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

  • Index Cond: (follow_up_count = '1'::text)
122. 10,246.833 10,366.776 ↑ 1.2 1,722 1,842

HashAggregate (cost=32,419.28..32,656.09 rows=2,105 width=1,292) (actual time=0.116..5.628 rows=1,722 loops=1,842)

  • Group Key: chwview_assessment.chw_uuid, 0
123. 119.943 119.943 ↑ 1.0 102,959 1

Index Scan using chwview_assessment_reported_chw_uuid on chwview_assessment (cost=0.45..21,416.64 rows=104,787 width=352) (actual time=0.109..119.943 rows=102,959 loops=1)

  • Index Cond: ((reported_day >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
124. 1.753 263.888 ↑ 1.5 1,406 1

Materialize (cost=41,438.98..41,519.89 rows=2,089 width=48) (actual time=251.856..263.888 rows=1,406 loops=1)

125. 6.164 262.135 ↑ 1.5 1,406 1

GroupAggregate (cost=41,438.98..41,493.78 rows=2,089 width=48) (actual time=251.852..262.135 rows=1,406 loops=1)

  • Group Key: assess.chw, 0
126. 21.219 255.971 ↓ 4.1 13,934 1

Sort (cost=41,438.98..41,447.45 rows=3,391 width=77) (actual time=251.826..255.971 rows=13,934 loops=1)

  • Sort Key: assess.chw
  • Sort Method: quicksort Memory: 2344kB
127. 13.235 234.752 ↓ 4.1 13,934 1

Nested Loop (cost=4,118.44..41,240.14 rows=3,391 width=77) (actual time=44.978..234.752 rows=13,934 loops=1)

128. 33.136 76.885 ↓ 1.2 18,079 1

Bitmap Heap Scan on useview_assessment assess (cost=4,118.02..17,476.90 rows=14,608 width=81) (actual time=44.932..76.885 rows=18,079 loops=1)

  • Recheck Cond: ((referral_follow_up = 'true'::text) AND (reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
  • Heap Blocks: exact=7242
129. 2.668 43.749 ↓ 0.0 0 1

BitmapAnd (cost=4,118.02..4,118.02 rows=14,608 width=0) (actual time=43.749..43.749 rows=0 loops=1)

130. 16.773 16.773 ↓ 1.0 175,711 1

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

  • Index Cond: (referral_follow_up = 'true'::text)
131. 24.308 24.308 ↓ 1.1 91,183 1

Bitmap Index Scan on useview_assessment_reported_age_uuid (cost=0.00..2,317.68 rows=85,225 width=0) (actual time=24.308..24.308 rows=91,183 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
132. 144.632 144.632 ↑ 1.0 1 18,079

Index Scan using useview_assessment_follow_up_form_source_id on useview_assessment_follow_up follow_up (cost=0.42..1.62 rows=1 width=45) (actual time=0.008..0.008 rows=1 loops=18,079)

  • 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
133. 330.379 383.136 ↑ 3.1 710 1,842

HashAggregate (cost=4,219.84..4,241.96 rows=2,212 width=48) (actual time=0.031..0.208 rows=710 loops=1,842)

  • Group Key: meta.chw, 0
134. 52.757 52.757 ↑ 2.2 4,690 1

Index Scan using form_metadata_formname on form_metadata meta (cost=0.43..4,143.29 rows=10,206 width=76) (actual time=11.167..52.757 rows=4,690 loops=1)

  • Index Cond: (formname = 'community_event'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 47459
135. 43.610 3,299.022 ↑ 1.0 1 1,842

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

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

SubPlan (for Index Only Scan)

137. 6.366 1,259.928 ↑ 24.0 1 1,842

Nested Loop Semi Join (cost=0.56..1,910.10 rows=24 width=0) (actual time=0.684..0.684 rows=1 loops=1,842)

  • Join Filter: (meta_1.formname = "*VALUES*".column1)
  • Rows Removed by Join Filter: 3
138. 1,250.718 1,250.718 ↑ 167.5 2 1,842

Index Scan using form_metadata_chw on form_metadata meta_1 (cost=0.56..1,894.98 rows=335 width=15) (actual time=0.657..0.679 rows=2 loops=1,842)

  • Index Cond: (chw = chp.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 337
139. 2.839 2.844 ↑ 1.5 2 2,844

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

140. 0.005 0.005 ↑ 1.0 3 1

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

141. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.47..21,987.00 rows=53,471 width=36) (never executed)

142. 0.000 0.000 ↓ 0.0 0

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

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

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

144. 0.000 0.000 ↓ 0.0 0

Index Scan using form_metadata_formname on form_metadata meta_2 (cost=0.43..7,150.73 rows=17,824 width=51) (never executed)

  • Index Cond: (formname = "*VALUES*_1".column1)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
145. 0.119 34.069 ↓ 0.0 0 157

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

146. 0.119 33.912 ↓ 0.0 0 157

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

147. 0.471 33.755 ↓ 0.0 0 157

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

  • Join Filter: (chw.parent_uuid = cmd_1.parent_uuid)
148. 0.785 6.437 ↑ 1.0 1 157

Nested Loop (cost=0.85..4.89 rows=1 width=110) (actual time=0.040..0.041 rows=1 loops=157)

149. 3.611 3.611 ↑ 1.0 1 157

Index Scan using contactview_metadata_uuid on contactview_metadata chw (cost=0.43..2.45 rows=1 width=73) (actual time=0.023..0.023 rows=1 loops=157)

  • Index Cond: (uuid = chp.uuid)
150. 2.041 2.041 ↑ 1.0 1 157

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

  • Index Cond: (uuid = chw.parent_uuid)
  • Heap Fetches: 157
151. 26.847 26.847 ↓ 0.0 0 157

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

  • Index Cond: (parent_uuid = chwarea.uuid)
  • Filter: ((type = 'clinic'::text) AND (reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 92
152. 0.038 0.038 ↑ 1.0 1 1

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

  • 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[])))
153. 0.038 0.038 ↑ 1.0 1 1

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

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

Nested Loop (cost=1.99..113,348.89 rows=909,011 width=32) (never executed)

155. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.71..87,066.84 rows=74,084 width=1,396) (never executed)

156. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.28..29,417.14 rows=92,593 width=37) (never executed)

157. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.85..26,022.66 rows=3,923 width=73) (never executed)

158. 0.000 0.000 ↓ 0.0 0

Index Scan using contactview_metadata_type on contactview_metadata cmd_2 (cost=0.43..17,462.93 rows=3,923 width=36) (never executed)

  • Index Cond: (type = 'clinic'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
159. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

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

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

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

Nested Loop (cost=1.53..3,473.66 rows=1 width=0) (never executed)

164. 0.000 0.000 ↓ 0.0 0

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

165. 0.000 0.000 ↓ 0.0 0

Append (cost=0.42..1,956.41 rows=690 width=38) (never executed)

166. 0.000 0.000 ↓ 0.0 0

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_36 (cost=0.42..2.44 rows=1 width=1,030) (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_form_postnatal_care_expr_expr1_idx1 on pat_form_postnatal_care form_37 (cost=0.42..1,929.78 rows=679 width=26) (never executed)

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

Seq Scan on pat_district_hospital form_38 (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))
169. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using pat_form_expr_idx9 on pat_form form_40 (cost=0.14..2.16 rows=1 width=638) (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_health_center_expr_idx9 on pat_health_center form_41 (cost=0.28..2.30 rows=1 width=957) (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_info_expr_idx9 on pat_info form_42 (cost=0.43..2.46 rows=1 width=297) (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

Seq Scan on pat_meta form_43 (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))
174. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

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

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

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

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

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

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

  • Index Cond: (uuid = fm.uuid)
  • Filter: ((chw = chp.uuid) AND (reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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. 42.946 1,961.415 ↓ 36.9 4,717 1

Nested Loop (cost=1.53..3,471.93 rows=128 width=36) (actual time=1,065.718..1,961.415 rows=4,717 loops=1)

181. 1,109.961 1,579.606 ↓ 70.2 48,409 1

Nested Loop (cost=0.98..3,035.17 rows=690 width=74) (actual time=35.052..1,579.606 rows=48,409 loops=1)

182. 6.254 33.667 ↓ 70.2 48,442 1

Append (cost=0.42..1,956.41 rows=690 width=38) (actual time=0.051..33.667 rows=48,442 loops=1)

183. 0.008 0.008 ↓ 0.0 0 1

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

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
184. 27.324 27.324 ↓ 71.3 48,442 1

Index Scan using pat_form_postnatal_care_expr_expr1_idx1 on pat_form_postnatal_care form_49 (cost=0.42..1,929.78 rows=679 width=26) (actual time=0.042..27.324 rows=48,442 loops=1)

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

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

  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
  • Rows Removed by Filter: 14
186. 0.007 0.007 ↓ 0.0 0 1

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_51 (cost=0.29..2.31 rows=1 width=655) (actual time=0.007..0.007 rows=0 loops=1)

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

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

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

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

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

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

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

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

  • Filter: (((doc ->> 'form'::text) = 'postnatal_care'::text) AND ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text))
  • Rows Removed by Filter: 1
191. 0.006 0.006 ↓ 0.0 0 1

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

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

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

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

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 time=0.004..0.005 rows=0 loops=1)

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

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

  • Index Cond: ((doc ->> 'form'::text) = 'postnatal_care'::text)
  • Filter: ((doc #>> '{fields,follow_up_count}'::text[]) = '1'::text)
195. 435.978 435.978 ↑ 1.0 1 48,442

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

  • Index Cond: (uuid = (form_48.doc ->> '_id'::text))
  • Heap Fetches: 0
196. 338.863 338.863 ↓ 0.0 0 48,409

Index Scan using form_metadata_uuid on form_metadata meta_4 (cost=0.56..0.63 rows=1 width=72) (actual time=0.007..0.007 rows=0 loops=48,409)

  • Index Cond: (uuid = fm_1.uuid)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 1
197. 257,207.670 286,206.276 ↑ 1.2 1,743 1,842

GroupAggregate (cost=48,029.55..49,882.63 rows=2,085 width=48) (actual time=0.263..155.378 rows=1,743 loops=1,842)

  • Group Key: useview_households_visited.chw, 0
198. 28,795.112 28,998.606 ↓ 1.0 183,597 1,842

Sort (cost=48,029.55..48,487.61 rows=183,223 width=76) (actual time=0.220..15.743 rows=183,597 loops=1,842)

  • Sort Key: useview_households_visited.chw
  • Sort Method: quicksort Memory: 31963kB
199. 203.494 203.494 ↓ 1.0 183,597 1

Index Only Scan using households_date_visited_chw_hh on useview_households_visited (cost=0.58..32,012.89 rows=183,223 width=76) (actual time=0.038..203.494 rows=183,597 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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 Fetches: 183597
200. 1,449.396 1,466.232 ↑ 1.3 1,661 1,842

HashAggregate (cost=22,026.42..22,048.23 rows=2,181 width=152) (actual time=0.048..0.796 rows=1,661 loops=1,842)

  • Group Key: population_1.chp_area_uuid, 0
201. 16.836 16.836 ↑ 1.1 17,101 1

Index Scan using useview_population_demographics_reported_idx on useview_population_demographics population_1 (cost=0.45..15,439.07 rows=18,172 width=87) (actual time=0.051..16.836 rows=17,101 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
202. 2.019 188.384 ↑ 1.4 1,497 1

Materialize (cost=18,061.41..19,026.48 rows=2,114 width=64) (actual time=88.392..188.384 rows=1,497 loops=1)

203. 89.058 186.365 ↑ 1.4 1,497 1

GroupAggregate (cost=18,061.41..19,000.05 rows=2,114 width=64) (actual time=88.388..186.365 rows=1,497 loops=1)

  • Group Key: survey.chw, 0
204. 55.545 97.307 ↑ 1.0 40,122 1

Sort (cost=18,061.41..18,163.35 rows=40,778 width=88) (actual time=88.330..97.307 rows=40,122 loops=1)

  • Sort Key: survey.chw
  • Sort Method: quicksort Memory: 7179kB
205. 41.762 41.762 ↑ 1.0 40,122 1

Index Scan using useview_family_survey_uuid_reported_chw on useview_family_survey survey (cost=0.45..14,938.73 rows=40,778 width=88) (actual time=0.054..41.762 rows=40,122 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
206. 1,059.096 1,132.830 ↑ 71.4 1,123 1,842

HashAggregate (cost=11,294.68..12,096.07 rows=80,139 width=48) (actual time=0.073..0.615 rows=1,123 loops=1,842)

  • Group Key: contactview_metadata_1.parent_uuid, 0
207. 73.734 73.734 ↑ 1.0 239,512 1

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

  • Index Cond: (type = 'clinic'::text)
208. 1.910 1,041.513 ↓ 8.6 1,727 1

Materialize (cost=40,579.80..40,599.80 rows=200 width=80) (actual time=863.351..1,041.513 rows=1,727 loops=1)

209. 152.786 1,039.603 ↓ 8.6 1,727 1

GroupAggregate (cost=40,579.80..40,597.30 rows=200 width=80) (actual time=863.345..1,039.603 rows=1,727 loops=1)

  • Group Key: assess_u1fu_pnc_aggregated.chw, 0
210. 147.451 886.817 ↓ 418.1 83,615 1

Sort (cost=40,579.80..40,580.30 rows=200 width=96) (actual time=863.304..886.817 rows=83,615 loops=1)

  • Sort Key: assess_u1fu_pnc_aggregated.chw
  • Sort Method: quicksort Memory: 16500kB
211. 12.804 739.366 ↓ 418.1 83,615 1

Subquery Scan on assess_u1fu_pnc_aggregated (cost=39,998.52..40,572.15 rows=200 width=96) (actual time=681.902..739.366 rows=83,615 loops=1)

212. 24.025 726.562 ↓ 418.1 83,615 1

Unique (cost=39,998.52..40,570.15 rows=200 width=100) (actual time=681.885..726.562 rows=83,615 loops=1)

213. 397.329 702.537 ↓ 1.1 123,223 1

Sort (cost=39,998.52..40,284.34 rows=114,327 width=100) (actual time=681.882..702.537 rows=123,223 loops=1)

  • Sort Key: useview_assessment.patient_id, useview_assessment.reported DESC
  • Sort Method: quicksort Memory: 23425kB
214. 12.863 305.208 ↓ 1.1 123,223 1

Append (cost=0.45..30,393.45 rows=114,327 width=100) (actual time=0.060..305.208 rows=123,223 loops=1)

215. 136.386 136.386 ↑ 1.0 102,959 1

Index Scan using useview_assessment_reported on useview_assessment (cost=0.45..20,447.84 rows=105,858 width=94) (actual time=0.059..136.386 rows=102,959 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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. 9.015 9.015 ↑ 1.0 2,378 1

Index Scan using useview_u1_follow_up_reported_chw_uuid on useview_u1_follow_up (cost=0.32..746.18 rows=2,390 width=161) (actual time=0.075..9.015 rows=2,378 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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. 146.944 146.944 ↓ 2.9 17,886 1

Index Scan using useview_postnatal_reported on useview_postnatal_care useview_postnatal_care_1 (cost=0.45..7,484.52 rows=6,079 width=185) (actual time=0.140..146.944 rows=17,886 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 3
218. 0.010 100.144 ↓ 5.0 10 1

Materialize (cost=8,175.74..8,175.80 rows=2 width=48) (actual time=100.106..100.144 rows=10 loops=1)

219. 0.033 100.134 ↓ 5.0 10 1

GroupAggregate (cost=8,175.74..8,175.78 rows=2 width=48) (actual time=100.103..100.134 rows=10 loops=1)

  • Group Key: "*SELECT* 1".chw_uuid, 0
220. 0.030 100.101 ↓ 11.5 23 1

Sort (cost=8,175.74..8,175.74 rows=2 width=40) (actual time=100.093..100.101 rows=23 loops=1)

  • Sort Key: "*SELECT* 1".chw_uuid
  • Sort Method: quicksort Memory: 26kB
221. 0.005 100.071 ↓ 11.5 23 1

Result (cost=7,942.31..8,175.73 rows=2 width=40) (actual time=79.247..100.071 rows=23 loops=1)

222. 0.006 100.066 ↓ 11.5 23 1

Append (cost=7,942.31..8,175.71 rows=2 width=36) (actual time=79.245..100.066 rows=23 loops=1)

223. 0.047 79.285 ↓ 13.0 13 1

Subquery Scan on *SELECT* 1 (cost=7,942.31..7,942.54 rows=1 width=36) (actual time=79.243..79.285 rows=13 loops=1)

  • Filter: (("*SELECT* 1".reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::interval)))::timestamp without time zone) AND ("*SELECT* 1".reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 5
224. 0.013 79.238 ↓ 3.6 18 1

Unique (cost=7,942.31..7,942.33 rows=5 width=80) (actual time=79.222..79.238 rows=18 loops=1)

225. 0.053 79.225 ↓ 11.6 58 1

Sort (cost=7,942.31..7,942.32 rows=5 width=80) (actual time=79.220..79.225 rows=58 loops=1)

  • Sort Key: pv_2.patient_id
  • Sort Method: quicksort Memory: 33kB
226. 27.209 79.172 ↓ 11.6 58 1

Hash Join (cost=230.04..7,942.25 rows=5 width=80) (actual time=19.019..79.172 rows=58 loops=1)

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

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

  • Filter: (patient_id <> ''::text)
  • Rows Removed by Filter: 90
228. 4.465 17.914 ↓ 638.0 638 1

Hash (cost=230.03..230.03 rows=1 width=1,626) (actual time=17.914..17.914 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1052kB
229. 8.226 13.449 ↓ 638.0 638 1

Hash Join (cost=47.78..230.03 rows=1 width=1,626) (actual time=0.455..13.449 rows=638 loops=1)

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

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

231. 0.018 0.018 ↓ 0.0 0 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
243. 0.160 0.388 ↑ 1.3 638 1

Hash (cost=36.98..36.98 rows=831 width=80) (actual time=0.388..0.388 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
244. 0.228 0.228 ↑ 1.3 638 1

Index Scan using form_metadata_formname on form_metadata dr (cost=0.43..36.98 rows=831 width=80) (actual time=0.020..0.228 rows=638 loops=1)

  • Index Cond: (formname = 'death_report'::text)
245. 0.029 20.775 ↓ 10.0 10 1

Subquery Scan on *SELECT* 2 (cost=233.10..233.15 rows=1 width=36) (actual time=20.745..20.775 rows=10 loops=1)

  • Filter: (("*SELECT* 2".reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::interval)))::timestamp without time zone) AND ("*SELECT* 2".reported < ((date_trunc('day'::text, (date_trunc('month'::text, now()) - '1 day'::interval)) + '1 day'::interval))::timestamp without time zone))
  • Rows Removed by Filter: 6
246. 0.010 20.746 ↓ 16.0 16 1

Unique (cost=233.10..233.11 rows=1 width=80) (actual time=20.734..20.746 rows=16 loops=1)

247. 0.042 20.736 ↓ 40.0 40 1

Sort (cost=233.10..233.11 rows=1 width=80) (actual time=20.733..20.736 rows=40 loops=1)

  • Sort Key: pc_1.patient_id
  • Sort Method: quicksort Memory: 30kB
248. 3.838 20.694 ↓ 40.0 40 1

Nested Loop (cost=48.21..233.09 rows=1 width=80) (actual time=3.068..20.694 rows=40 loops=1)

249. 8.008 13.028 ↓ 638.0 638 1

Hash Join (cost=47.78..230.03 rows=1 width=1,626) (actual time=0.440..13.028 rows=638 loops=1)

  • Hash Cond: ((form_12.doc ->> '_id'::text) = dr_1.uuid)
250. 0.070 4.641 ↑ 1.0 638 1

Append (cost=0.42..180.88 rows=649 width=1,582) (actual time=0.032..4.641 rows=638 loops=1)

251. 0.012 0.012 ↓ 0.0 0 1

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

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

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

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

Seq Scan on pat_district_hospital form_14 (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
254. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_15 (cost=0.29..2.31 rows=1 width=655) (actual time=0.005..0.005 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_form_expr_idx9 on pat_form form_16 (cost=0.14..2.16 rows=1 width=638) (actual time=0.003..0.003 rows=0 loops=1)

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

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

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

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

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

Seq Scan on pat_meta form_19 (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
259. 0.005 0.005 ↓ 0.0 0 1

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

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

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

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

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

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

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

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

Hash (cost=36.98..36.98 rows=831 width=80) (actual time=0.379..0.379 rows=638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
264. 0.212 0.212 ↑ 1.3 638 1

Index Scan using form_metadata_formname on form_metadata dr_1 (cost=0.43..36.98 rows=831 width=80) (actual time=0.018..0.212 rows=638 loops=1)

  • Index Cond: (formname = 'death_report'::text)
265. 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.05 rows=1 width=36) (actual time=0.005..0.006 rows=0 loops=638)

  • Index Cond: (patient_id = (form_12.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
266. 1.466 1,815.253 ↑ 1.0 1,728 1

Materialize (cost=77,824.05..82,303.53 rows=1,777 width=48) (actual time=1,279.249..1,815.253 rows=1,728 loops=1)

267. 436.796 1,813.787 ↑ 1.0 1,728 1

GroupAggregate (cost=77,824.05..82,281.32 rows=1,777 width=48) (actual time=1,279.246..1,813.787 rows=1,728 loops=1)

  • Group Key: useview_home_visit.reported_by, 0
268. 903.534 1,376.991 ↓ 1.0 448,201 1

Sort (cost=77,824.05..78,933.92 rows=443,950 width=77) (actual time=1,279.144..1,376.991 rows=448,201 loops=1)

  • Sort Key: useview_home_visit.reported_by
  • Sort Method: external merge Disk: 39912kB
269. 473.457 473.457 ↓ 1.0 448,201 1

Index Scan using useview_home_visit_reported_idx on useview_home_visit (cost=0.46..36,181.45 rows=443,950 width=77) (actual time=0.095..473.457 rows=448,201 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
270. 0.791 2,360.595 ↓ 1.2 2,707 1

Hash (cost=169,288.69..169,288.69 rows=2,295 width=48) (actual time=2,360.595..2,360.595 rows=2,707 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 255kB
271. 0.339 2,359.804 ↓ 1.2 2,708 1

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

272. 1,412.156 2,359.465 ↓ 1.2 2,708 1

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

  • Group Key: useview_chp_sync.chw_uuid, 0
273. 947.309 947.309 ↑ 1.0 5,332,505 1

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

274. 0.487 391.374 ↓ 8.1 1,619 1

Hash (cost=4.00..4.00 rows=200 width=52) (actual time=391.374..391.374 rows=1,619 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 162kB
275. 390.887 390.887 ↓ 8.1 1,619 1

CTE Scan on fp (cost=0.00..4.00 rows=200 width=52) (actual time=378.072..390.887 rows=1,619 loops=1)

276. 0.060 21.214 ↓ 1.3 192 1

Hash (cost=257.72..257.72 rows=149 width=56) (actual time=21.214..21.214 rows=192 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 26kB
277. 0.026 21.154 ↓ 1.3 192 1

Subquery Scan on infant_deaths (cost=254.74..257.72 rows=149 width=56) (actual time=21.088..21.154 rows=192 loops=1)

278. 7.827 21.128 ↓ 1.3 192 1

HashAggregate (cost=254.74..256.23 rows=149 width=56) (actual time=21.086..21.128 rows=192 loops=1)

  • Group Key: dr_2.chw, 0
279. 7.115 13.301 ↓ 2.5 384 1

Hash Right Join (cost=66.33..248.58 rows=154 width=1,622) (actual time=3.493..13.301 rows=384 loops=1)

  • Hash Cond: ((form_24.doc ->> '_id'::text) = dr_2.uuid)
280. 0.072 5.068 ↑ 1.0 638 1

Append (cost=0.42..180.88 rows=649 width=1,582) (actual time=0.030..5.068 rows=638 loops=1)

281. 0.006 0.006 ↓ 0.0 0 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  • Index Cond: ((doc ->> 'form'::text) = 'death_report'::text)
293. 0.104 1.118 ↓ 2.5 384 1

Hash (cost=63.98..63.98 rows=154 width=72) (actual time=1.118..1.118 rows=384 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 48kB
294. 1.014 1.014 ↓ 2.5 384 1

Index Scan using form_metadata_formname on form_metadata dr_2 (cost=0.43..63.98 rows=154 width=72) (actual time=0.191..1.014 rows=384 loops=1)

  • Index Cond: (formname = 'death_report'::text)
  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 254
295. 0.053 33.739 ↑ 1.6 122 1

Hash (cost=10,157.36..10,157.36 rows=200 width=97) (actual time=33.739..33.739 rows=122 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
296. 0.019 33.686 ↑ 1.6 122 1

Subquery Scan on fp_fu_ke (cost=7,387.58..10,157.36 rows=200 width=97) (actual time=31.602..33.686 rows=122 loops=1)

297. 1.718 33.667 ↑ 1.6 122 1

GroupAggregate (cost=7,387.58..10,155.36 rows=200 width=97) (actual time=31.600..33.667 rows=122 loops=1)

  • Group Key: "*SELECT* 1_1".reported_by, 0
298. 5.166 31.949 ↑ 11.7 5,555 1

Sort (cost=7,387.58..7,550.28 rows=65,077 width=178) (actual time=31.559..31.949 rows=5,555 loops=1)

  • Sort Key: "*SELECT* 1_1".reported_by
  • Sort Method: quicksort Memory: 1668kB
299. 2.718 26.783 ↑ 11.7 5,555 1

Merge Right Join (cost=1,196.94..2,184.72 rows=65,077 width=178) (actual time=23.388..26.783 rows=5,555 loops=1)

  • Merge Cond: (useview_fp_follow_up_prospective_ke.source_id = "*SELECT* 1_1".form_uuid)
300. 3.928 4.759 ↑ 1.0 2,325 1

Sort (cost=222.88..228.69 rows=2,325 width=89) (actual time=4.507..4.759 rows=2,325 loops=1)

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

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

302. 0.236 0.236 ↑ 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.029..0.236 rows=930 loops=1)

303. 0.141 0.141 ↓ 1.0 683 1

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

304. 0.222 0.222 ↑ 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.020..0.222 rows=713 loops=1)

305. 10.966 19.306 ↑ 1.0 5,555 1

Sort (cost=974.07..988.06 rows=5,598 width=122) (actual time=18.855..19.306 rows=5,555 loops=1)

  • Sort Key: "*SELECT* 1_1".form_uuid
  • Sort Method: quicksort Memory: 1667kB
306. 0.582 8.340 ↑ 1.0 5,551 1

Append (cost=0.30..625.57 rows=5,598 width=122) (actual time=0.073..8.340 rows=5,551 loops=1)

307. 0.139 2.093 ↑ 1.0 1,086 1

Subquery Scan on *SELECT* 1_1 (cost=0.30..143.69 rows=1,090 width=122) (actual time=0.072..2.093 rows=1,086 loops=1)

308. 0.139 1.954 ↑ 1.0 1,086 1

Result (cost=0.30..132.79 rows=1,090 width=122) (actual time=0.071..1.954 rows=1,086 loops=1)

309. 0.110 1.815 ↑ 1.0 1,086 1

Append (cost=0.30..121.89 rows=1,090 width=121) (actual time=0.069..1.815 rows=1,086 loops=1)

310. 0.445 0.445 ↑ 1.0 405 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..38.71 rows=406 width=121) (actual time=0.068..0.445 rows=405 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
311. 0.318 0.318 ↑ 1.0 366 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..29.42 rows=366 width=121) (actual time=0.039..0.318 rows=366 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
312. 0.942 0.942 ↑ 1.0 315 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=318 width=121) (actual time=0.070..0.942 rows=315 loops=1)

  • Filter: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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: 398
313. 0.571 5.665 ↑ 1.0 4,465 1

Subquery Scan on *SELECT* 2_1 (cost=0.31..453.89 rows=4,508 width=122) (actual time=0.070..5.665 rows=4,465 loops=1)

314. 5.094 5.094 ↑ 1.0 4,465 1

Index Scan using index_useview_fp_registration_ke_reported_patient_id_uuid on useview_fp_registration_ke (cost=0.31..408.81 rows=4,508 width=122) (actual time=0.067..5.094 rows=4,465 loops=1)

  • Index Cond: ((reported >= (date_trunc('day'::text, (date_trunc('month'::text, now()) - '3 mons'::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))
Planning time : 53.511 ms
Execution time : 331,687.901 ms