explain.depesz.com

PostgreSQL's explain analyze made readable

Result: v3Bq

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.066 ↑ 1.1 23 1

Index Scan using contactview_metadata_type on contactview_metadata cmd (cost=0.43..2.99 rows=25 width=52) (actual time=0.049..0.066 rows=23 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
  • Hash Cond: (chp_1.branch_uuid = cmd.uuid)
  • Index Cond: ((next_refill_reinjection_date >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (next_refill_reinjection_date < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Index Cond: (uuid = chp_1.supervisor_uuid)
  • Buckets: 16,384 Batches: 1 Memory Usage: 1,530kB
  • Filter: (((doc ->> 'is_in_fp_pilot'::text))::boolean AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
  • Filter: (((doc ->> 'is_in_fp_pilot'::text))::boolean AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
  • Filter: (((doc ->> 'is_in_fp_pilot'::text))::boolean AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
  • Filter: (((doc ->> 'is_in_fp_pilot'::text))::boolean AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
  • Filter: (((doc ->> 'is_in_fp_pilot'::text))::boolean AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
  • Heap Fetches: 103
  • Index Cond: ((doc ->> '_id'::text) = chp_1.uuid)
  • Index Cond: ((doc ->> '_id'::text) = chp_1.uuid)
  • Index Cond: ((doc ->> '_id'::text) = chp_1.uuid)
  • Index Cond: ((doc ->> '_id'::text) = chp_1.uuid)
  • Index Cond: ((doc ->> '_id'::text) = chp_1.uuid)
  • Index Cond: (chw = chp_1.uuid)
  • Rows Removed by Filter: 1
  • Sort Key: generate_series_1.generate_series
  • Sort Method: quicksort Memory: 25kB
  • Hash Cond: (refill.""inputs/source_id"" = upcoming_refills.xmlforms_uuid)
  • Sort Key: generate_series.generate_series
  • Sort Method: quicksort Memory: 25kB
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text)))
  • Filter: (((doc ->> 'form'::text) = 'fp_follow_up_refill'::text) AND ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text))))
  • Filter: (((doc ->> 'form'::text) = 'fp_follow_up_refill'::text) AND ((((doc #>> '{fields,group_fp,ready_to_proceed}'::text[]) = 'yes'::text) AND ((doc #>> '{fields,on_pill}'::text[]) = 'true'::text)) OR (((doc #>> '{fields,fp_method_administered}'::text[]) <> ''::text) AND ((doc #>> '{fields,newly_on_pill}'::text[]) = 'true'::text))))
  • Filter: (((ready_to_proceed = 'yes'::text) AND (on_injection = 'true'::text)) OR ((fp_method_administered <> ''::text) AND (newly_on_injection = 'true'::text)))
  • Filter: ((reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Group Key: upcoming_refills.chw, 0
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_refill'::text)
  • Rows Removed by Filter: 1
  • Rows Removed by Filter: 26,229
  • Rows Removed by Filter: 35,585
  • Rows Removed by Filter: 50,835
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Filter: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Filter: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Group Key: useview_fp_follow_up_refill.chw, 0
  • Group Key: useview_fp_follow_up_refill_1.chw, useview_fp_follow_up_refill_1.patient_id
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((doc ->> 'form'::text) = 'fp_follow_up_long_term'::text)
  • Index Cond: ((reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Index Cond: (uuid = (form_12.doc ->> '_id'::text))
  • Rows Removed by Filter: 1
  • Buckets: 32,768 (originally 16384) Batches: 1 (originally 1) Memory Usage: 3,593kB
  • Buckets: 4,096 Batches: 1 Memory Usage: 208kB
  • Hash Cond: ((row_number() OVER (?)) = interval_startseries.row_number)
  • Heap Fetches: 894
  • Index Cond: (uuid = chp.uuid)
  • Index Cond: (uuid = chw.parent_uuid)
  • Buckets: 2,048 Batches: 1 Memory Usage: 101kB
  • Group Key: reinjections.chw, 0
  • Hash Cond: ((chp_1.uuid = refills_due.chw_uuid) AND ((0) = refills_due.interval_number))
  • Hash Cond: ((form.doc #>> '{fields,inputs,source_id}'::text[]) = visit.xmlforms_uuid)
  • Sort Key: meta.chw, ((form_12.doc #>> '{fields,patient_id}'::text[]))
  • Sort Method: quicksort Memory: 3,540kB
  • Filter: ((type = 'clinic'::text) AND (reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Index Cond: ((reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Index Cond: (chw = chp.uuid)
  • Index Cond: (parent_uuid = chwarea.uuid)
  • Rows Removed by Filter: 143
  • Filter: ((date_of_birth IS NOT NULL) AND (date_trunc('day'::text, date_trunc('month'::text, now())) > reported_date) AND (date_part('year'::text, age(date_trunc('day'::text, date_trunc('month'::text, now())), (date_of_birth)::timestamp with time zone)) >= '18'::double precision) AND (date_part('year'::text, age(date_trunc('day'::text, date_trunc('month'::text, now())), (date_of_birth)::timestamp with time zone)) <= '49'::double precision))
  • Group Key: meta.chw, ((form_12.doc #>> '{fields,patient_id}'::text[]))
  • Hash Cond: ((chp_1.uuid = refills.chw_uuid) AND ((0) = refills.interval_number))
  • Rows Removed by Filter: 811,038
  • Sort Key: visit.chw
  • Sort Method: quicksort Memory: 5,611kB
  • Filter: (((doc ->> 'type'::text) = 'person'::text) AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
  • Index Cond: ((doc ->> '_id'::text) = chp.uuid)
  • Join Filter: (chw.parent_uuid = cmd_1.parent_uuid)
  • Group Key: visit.chw, 0
  • Sort Key: chp_1.uuid, (0)
  • Sort Key: reinjection_breakdown.chw_uuid, reinjection_breakdown.interval_number
  • Sort Method: quicksort Memory: 254kB
  • Sort Method: quicksort Memory: 870kB
  • Filter: (((doc ->> 'type'::text) = 'health_center'::text) AND ((doc ->> 'type'::text) = ANY ('{contact,clinic,district_hospital,health_center,person}'::text[])))
  • Heap Blocks: exact=10,535
  • Index Cond: ((doc ->> '_id'::text) = (pat_person_1.doc #>> '{parent,_id}'::text[]))
  • Index Cond: ((reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Recheck Cond: ((chw = chp.uuid) AND (reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Group Key: refills_1.chw, 0
  • Merge Cond: ((chp_1.uuid = reinjection_breakdown.chw_uuid) AND ((0) = reinjection_breakdown.interval_number))
  • Filter: (follow_up_count = '1'::text)
  • Hash Cond: (meta_2.formname = ""*VALUES*_1"".column1)
  • Index Cond: ((follow_up_count = '1'::text) AND (reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone))
  • Index Cond: ((reported >= (date_trunc('day'::text, date_trunc('month'::text, now())))::timestamp without time zone) AND (reported < ((date_trunc('day'::text, now()) + '1 day'::interval))::timestamp without time zone) AND (chw = chp.uuid))
  • Join Filter: (meta_1.formname = ""*VALUES*"".column1)
  • Rows Removed by Filter: 0
  • Rows Removed by Join Filter: 11
  • Group Key: women.chw_uuid, date_trunc('day'::text, date_trunc('month'::text, now()))
  • Join Filter: ((0) = (0))
  • Merge Cond: (chp_1.uuid = visit.chw)
  • Heap Fetches: 2,852
  • Index Cond: (uuid = chp_1.uuid)
  • Join Filter: ((0) = (0))
  • Merge Cond: (chp_1.uuid = refills_1.chw)
  • Buckets: 8,192 Batches: 1 Memory Usage: 601kB
  • Join Filter: ((0) = 0)
  • Hash Cond: ((chp_1.uuid = eligible_women.chw_uuid) AND (interval_startseries.interval_start = eligible_women.interval_start))
  • Sort Key: cmd.name, cmeta.name, chp_1.name, (date(interval_startseries.interval_start)), cmd.uuid, chp_1.supervisor_uuid, chp_1.uuid, chp_1.phone, (0)
  • Sort Method: quicksort Memory: 1,331kB
  • Functions: 364
  • Group Key: cmd.name, cmeta.name, chp_1.name, (date(interval_startseries.interval_start)), cmd.uuid, chp_1.supervisor_uuid, chp_1.uuid, chp_1.phone, (0), 'N/A'::text
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 49.192 ms, Inlining 0.000 ms, Optimization 19.081 ms, Emission 335.114 ms, Total 403.387 ms
2. 0.074 0.074 ↑ 1.1 23 1

Hash (cost=2.99..2.99 rows=25 width=52) (actual time=0.074..0.074 rows=23 loops=1)

3. 3.071 3.071 ↑ 1.0 15,402 1

Seq Scan on contactview_chp chp_1 (cost=0.00..582.02 rows=15,402 width=130) (actual time=0.011..3.071 rows=15,402 loops=1)

4. 0.008 0.008 ↑ 1,000.0 1 1

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

5. 12.680 12.680 ↓ 15,284.0 15,284 1

Hash Join (cost=3.31..625.76 rows=1 width=149) (actual time=0.098..12.680 rows=15,284 loops=1)

6. 106.988 106.988 ↑ 1.0 1 15,284

Index Scan using contactview_metadata_uuid on contactview_metadata cmeta (cost=0.56..2.25 rows=1 width=52) (actual time=0.007..0.007 rows=1 loops=15,284)

7. 18.868 18.868 ↓ 1.0 11,957 1

Index Scan using useview_upcoming_fp_refill_reinjections_date on useview_upcoming_fp_refill_reinjections upcoming_refills (cost=0.44..4,224.97 rows=11,813 width=86) (actual time=0.040..18.868 rows=11,957 loops=1)

8. 362.867 362.867 ↑ 1.0 1 1

Function Scan on generate_series (cost=0.04..0.05 rows=1 width=4) (actual time=362.866..362.867 rows=1 loops=1)

9. 22.171 22.171 ↓ 1.0 11,957 1

Hash (cost=4,224.97..4,224.97 rows=11,813 width=86) (actual time=22.171..22.171 rows=11,957 loops=1)

10. 45.753 45.753 ↓ 0.0 0 15,251

Index Only Scan using chp_muting_chw on chp_muting (cost=0.28..0.30 rows=1 width=36) (actual time=0.003..0.003 rows=0 loops=15,251)

11. 96.614 96.614 ↓ 0.0 0 13,802

Index Scan using couchdb_default_expr_idx8 on couchdb_default (cost=0.55..2.14 rows=1 width=808) (actual time=0.007..0.007 rows=0 loops=13,802)

12. 96.614 96.614 ↓ 0.0 0 13,802

Index Scan using pat_clinic_expr_idx8 on pat_clinic (cost=0.42..1.90 rows=1 width=560) (actual time=0.007..0.007 rows=0 loops=13,802)

13. 13.802 13.802 ↓ 0.0 0 13,802

Index Scan using pat_district_hospital_expr_idx8 on pat_district_hospital (cost=0.14..0.17 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=13,802)

14. 55.208 55.208 ↓ 0.0 0 13,802

Index Scan using pat_health_center_expr_idx8 on pat_health_center (cost=0.29..0.38 rows=1 width=736) (actual time=0.004..0.004 rows=0 loops=13,802)

15. 262.238 262.238 ↓ 0.0 0 13,802

Index Scan using pat_person_expr_idx8 on pat_person (cost=0.56..2.34 rows=1 width=652) (actual time=0.019..0.019 rows=0 loops=13,802)

16. 120.714 120.714 ↓ 15,251.0 15,251 1

Nested Loop (cost=3.86..628.00 rows=1 width=165) (actual time=0.115..120.714 rows=15,251 loops=1)

17. 9.100 9.100 ↓ 1.0 55,043 1

Seq Scan on useview_fp_follow_up_refill refill (cost=0.00..3,985.04 rows=55,004 width=44) (actual time=0.005..9.100 rows=55,043 loops=1)

18. 0.012 0.012 ↑ 1,000.0 1 1

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

19. 538.278 538.278 ↓ 0.0 0 13,802

Append (cost=0.42..6.95 rows=5 width=630) (actual time=0.038..0.039 rows=0 loops=13,802)

20. 49.037 49.037 ↓ 1.0 12,001 1

Hash Right Join (cost=4,372.64..8,502.06 rows=11,813 width=61) (actual time=37.217..49.037 rows=12,001 loops=1)

21. 168.813 168.813 ↓ 13,802.0 13,802 1

Nested Loop Anti Join (cost=4.14..628.32 rows=1 width=165) (actual time=0.126..168.813 rows=13,802 loops=1)

22. 362.871 362.871 ↑ 1.0 1 1

Sort (cost=0.06..0.06 rows=1 width=4) (actual time=362.871..362.871 rows=1 loops=1)

23. 0.017 0.017 ↑ 1,000.0 1 1

WindowAgg (cost=59.84..84.84 rows=1,000 width=24) (actual time=0.016..0.017 rows=1 loops=1)

24. 56.039 56.039 ↑ 1.4 1,679 1

HashAggregate (cost=9,033.65..9,057.72 rows=2,407 width=71) (actual time=55.679..56.039 rows=1,679 loops=1)

25. 0.005 0.005 ↓ 0.0 0 1

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_23 (cost=0.42..2.46 rows=1 width=808) (actual time=0.005..0.005 rows=0 loops=1)

26. 0.010 0.010 ↓ 0.0 0 1

Index Scan using pat_clinic_expr_idx9 on pat_clinic form_12 (cost=0.42..2.46 rows=1 width=560) (actual time=0.010..0.010 rows=0 loops=1)

27. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_district_hospital_expr_idx9 on pat_district_hospital form_14 (cost=0.14..2.18 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1)

28. 0.007 0.007 ↓ 0.0 0 1

Index Scan using pat_feedback_expr_idx9 on pat_feedback form_15 (cost=0.29..2.33 rows=1 width=674) (actual time=0.007..0.007 rows=0 loops=1)

29. 0.003 0.003 ↓ 0.0 0 1

Index Scan using pat_form_expr_idx9 on pat_form form_16 (cost=0.14..2.18 rows=1 width=615) (actual time=0.003..0.003 rows=0 loops=1)

30. 0.009 0.009 ↓ 0.0 0 1

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_17 (cost=0.29..2.32 rows=1 width=736) (actual time=0.009..0.009 rows=0 loops=1)

31. 0.006 0.006 ↓ 0.0 0 1

Index Scan using pat_info_expr_idx9 on pat_info form_18 (cost=0.43..2.47 rows=1 width=291) (actual time=0.006..0.006 rows=0 loops=1)

32. 0.006 0.006 ↓ 0.0 0 1

Index Scan using pat_person_expr_idx9 on pat_person form_20 (cost=0.43..2.47 rows=1 width=652) (actual time=0.006..0.006 rows=0 loops=1)

33. 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.32 rows=1 width=599) (actual time=0.004..0.004 rows=0 loops=1)

34. 0.004 0.004 ↓ 0.0 0 1

Index Scan using pat_usage_stats_expr_idx9 on pat_usage_stats form_22 (cost=0.14..2.18 rows=1 width=1,078) (actual time=0.004..0.004 rows=0 loops=1)

35. 719.592 719.592 ↓ 25.9 2,852 1

Nested Loop (cost=4.56..635.32 rows=110 width=165) (actual time=0.305..719.592 rows=2,852 loops=1)

36. 2,368.709 2,368.709 ↓ 69.8 19,827 1

Seq Scan on pat_data_record_fp_follow_up_refill form_13 (cost=0.00..7,281.27 rows=284 width=637) (actual time=0.257..2,368.709 rows=19,827 loops=1)

37. 0.022 0.022 ↓ 0.0 0 1

Seq Scan on pat_meta form_19 (cost=0.00..1.03 rows=1 width=32) (actual time=0.022..0.022 rows=0 loops=1)

38. 74.847 74.847 ↓ 1.8 4,208 1

Seq Scan on useview_fp_follow_up_refill (cost=0.00..5,360.14 rows=2,396 width=52) (actual time=66.696..74.847 rows=4,208 loops=1)

39. 42.582 42.582 ↓ 1.0 28,814 1

Seq Scan on useview_fp_follow_up_refill useview_fp_follow_up_refill_1 (cost=0.00..4,535.08 rows=28,484 width=71) (actual time=0.010..42.582 rows=28,814 loops=1)

40. 0.018 0.018 ↑ 1,000.0 1 1

Subquery Scan on interval_startseries (cost=59.84..94.84 rows=1,000 width=16) (actual time=0.018..0.018 rows=1 loops=1)

41. 362.878 362.878 ↑ 1.0 1 1

WindowAgg (cost=0.06..0.08 rows=1 width=16) (actual time=362.876..362.878 rows=1 loops=1)

42. 2,371.792 2,371.792 ↓ 67.2 19,827 1

Append (cost=0.42..7,307.14 rows=295 width=634) (actual time=0.268..2,371.792 rows=19,827 loops=1)

43. 0.020 0.020 ↑ 1,000.0 1 1

Hash (cost=94.84..94.84 rows=1,000 width=16) (actual time=0.020..0.020 rows=1 loops=1)

44. 56.531 56.531 ↑ 1.3 13,684 1

HashAggregate (cost=4,748.71..4,922.56 rows=17,385 width=79) (actual time=53.613..56.531 rows=13,684 loops=1)

45. 76.695 76.695 ↑ 1.5 876 1

HashAggregate (cost=5,414.05..5,426.92 rows=1,287 width=79) (actual time=76.475..76.695 rows=876 loops=1)

46. 0.005 0.005 ↓ 0.0 0 1

Index Scan using couchdb_default_expr_idx9 on couchdb_default form_11 (cost=0.42..2.44 rows=1 width=808) (actual time=0.005..0.005 rows=0 loops=1)

47. 257.751 257.751 ↑ 1.0 1 19,827

Index Scan using form_metadata_uuid on form_metadata meta (cost=0.56..2.58 rows=1 width=73) (actual time=0.013..0.013 rows=1 loops=19,827)

48. 0.010 0.010 ↓ 0.0 0 1

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

49. 0.003 0.003 ↓ 0.0 0 1

Index Scan using pat_district_hospital_expr_idx9 on pat_district_hospital form_2 (cost=0.14..2.16 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

50. 0.005 0.005 ↓ 0.0 0 1

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

51. 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=615) (actual time=0.003..0.003 rows=0 loops=1)

52. 0.005 0.005 ↓ 0.0 0 1

Index Scan using pat_health_center_expr_idx9 on pat_health_center form_5 (cost=0.29..2.30 rows=1 width=736) (actual time=0.005..0.005 rows=0 loops=1)

53. 0.010 0.010 ↓ 0.0 0 1

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

54. 0.006 0.006 ↓ 0.0 0 1

Index Scan using pat_person_expr_idx9 on pat_person form_8 (cost=0.43..2.45 rows=1 width=652) (actual time=0.006..0.006 rows=0 loops=1)

55. 0.005 0.005 ↓ 0.0 0 1

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

56. 0.008 0.008 ↓ 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,078) (actual time=0.008..0.008 rows=0 loops=1)

57. 19.108 19.108 ↓ 1.5 22,556 1

Index Scan using useview_fp_visit_reported_xmlforms_uuid on useview_fp_visit visit (cost=0.44..7,249.06 rows=15,055 width=117) (actual time=0.058..19.108 rows=22,556 loops=1)

58. 1,083.084 1,083.084 ↓ 25.9 2,852 1

Nested Loop (cost=4.62..636.51 rows=110 width=177) (actual time=363.184..1,083.084 rows=2,852 loops=1)

59. 114.732 114.732 ↓ 1.0 16,709 1

Seq Scan on pat_data_record_fp_follow_up_long_term form_1 (cost=0.00..3,966.38 rows=16,692 width=1,596) (actual time=0.032..114.732 rows=16,709 loops=1)

60. 0.019 0.019 ↓ 0.0 0 1

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

61. 56.206 56.206 ↑ 1.4 1,679 1

Subquery Scan on refills_due (cost=9,033.65..9,081.79 rows=2,407 width=71) (actual time=55.680..56.206 rows=1,679 loops=1)

62. 116.234 116.234 ↓ 1.0 16,709 1

Append (cost=0.42..4,074.07 rows=16,703 width=1,595) (actual time=0.043..116.234 rows=16,709 loops=1)

63. 26.307 26.307 ↓ 1.5 22,556 1

Hash (cost=7,249.06..7,249.06 rows=15,055 width=117) (actual time=26.307..26.307 rows=22,556 loops=1)

64. 56.624 56.624 ↑ 1.4 1,679 1

Hash (cost=9,081.79..9,081.79 rows=2,407 width=71) (actual time=56.624..56.624 rows=1,679 loops=1)

65. 1,084.577 1,084.577 ↓ 5.2 2,852 1

Hash Join (cost=111.96..763.37 rows=550 width=209) (actual time=363.213..1,084.577 rows=2,852 loops=1)

66. 3,017.706 3,017.706 ↓ 66.8 19,705 1

Nested Loop (cost=0.99..8,068.98 rows=295 width=68) (actual time=0.325..3,017.706 rows=19,705 loops=1)

67. 76.799 76.799 ↑ 1.5 876 1

Subquery Scan on refills (cost=5,414.05..5,439.79 rows=1,287 width=63) (actual time=76.476..76.799 rows=876 loops=1)

68. 57.927 57.927 ↑ 1.3 13,684 1

Subquery Scan on reinjections (cost=4,748.71..5,096.41 rows=17,385 width=47) (actual time=53.615..57.927 rows=13,684 loops=1)

69. 9.834 9.834 ↑ 1.0 1 894

Index Only Scan using contactview_metadata_uuid on contactview_metadata chwarea (cost=0.56..2.57 rows=1 width=36) (actual time=0.011..0.011 rows=1 loops=894)

70. 13.410 13.410 ↑ 1.0 1 894

Index Scan using contactview_metadata_uuid on contactview_metadata chw (cost=0.56..2.57 rows=1 width=72) (actual time=0.015..0.015 rows=1 loops=894)

71. 77.054 77.054 ↑ 1.5 876 1

Hash (cost=5,439.79..5,439.79 rows=1,287 width=63) (actual time=77.054..77.054 rows=876 loops=1)

72. 1,143.448 1,143.448 ↓ 5.2 2,852 1

Hash Left Join (cost=9,229.85..9,889.65 rows=550 width=209) (actual time=419.848..1,143.448 rows=2,852 loops=1)

73. 247.748 247.748 ↓ 1.5 22,558 1

Hash Right Join (cost=7,437.67..11,602.75 rows=15,055 width=1,679) (actual time=67.980..247.748 rows=22,558 loops=1)

74. 62.365 62.365 ↓ 7.3 1,459 1

HashAggregate (cost=5,444.11..5,446.11 rows=200 width=63) (actual time=62.086..62.365 rows=1,459 loops=1)

75. 3,057.222 3,057.222 ↓ 66.8 19,705 1

Sort (cost=8,081.08..8,081.82 rows=295 width=68) (actual time=3,052.807..3,057.222 rows=19,705 loops=1)

76. 1,354.700 1,354.700 ↓ 1.4 2,988 2,852

Bitmap Index Scan on form_metadata_chw (cost=0.00..32.30 rows=2,099 width=0) (actual time=0.475..0.475 rows=2,988 loops=2,852)

77. 85,332.819 85,332.819 ↓ 55.4 466,873 2,717

Bitmap Index Scan on form_metadata_reported (cost=0.00..108.66 rows=8,420 width=0) (actual time=31.407..31.407 rows=466,873 loops=2,717)

78. 245.850 245.850 ↓ 0.0 0 894

Index Scan using contactview_metadata_parent_uuid on contactview_metadata cmd_1 (cost=0.56..1.12 rows=1 width=36) (actual time=0.275..0.275 rows=0 loops=894)

79. 26.820 26.820 ↑ 1.0 1 894

Nested Loop (cost=1.11..5.15 rows=1 width=108) (actual time=0.030..0.030 rows=1 loops=894)

80. 3,064.094 3,064.094 ↓ 15.9 4,685 1

GroupAggregate (cost=8,081.08..8,087.72 rows=295 width=76) (actual time=3,052.821..3,064.094 rows=4,685 loops=1)

81. 1,222.450 1,222.450 ↓ 5.2 2,852 1

Hash Left Join (cost=14,688.95..15,351.63 rows=550 width=233) (actual time=496.918..1,222.450 rows=2,852 loops=1)

82. 2,569.532 2,569.532 ↓ 93.6 716,337 1

Seq Scan on useview_registered_women women (cost=0.00..106,166.39 rows=7,651 width=72) (actual time=0.033..2,569.532 rows=716,337 loops=1)

83. 283.793 283.793 ↓ 1.5 22,558 1

Sort (cost=12,647.41..12,685.05 rows=15,055 width=1,679) (actual time=277.365..283.793 rows=22,558 loops=1)

84. 62.506 62.506 ↓ 7.3 1,459 1

Subquery Scan on reinjection_breakdown (cost=5,444.11..5,448.11 rows=200 width=63) (actual time=62.088..62.506 rows=1,459 loops=1)

85. 87,051.596 87,051.596 ↓ 0.0 0 2,852

BitmapAnd (cost=141.21..141.21 rows=1 width=0) (actual time=30.523..30.523 rows=0 loops=2,852)

86. 0.019 0.019 ↑ 1.0 1 1

Index Scan using pat_person_expr_idx8 on pat_person pat_person_1 (cost=0.56..2.59 rows=1 width=652) (actual time=0.019..0.019 rows=1 loops=1)

87. 275.352 275.352 ↓ 0.0 0 894

Nested Loop (cost=1.67..6.28 rows=1 width=36) (actual time=0.308..0.308 rows=0 loops=894)

88. 0.000 0.000 ↓ 0.0 0

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

89. 0.016 0.016 ↑ 1,000.0 1 1

Function Scan on generate_series generate_series_2 (cost=0.01..10.01 rows=1,000 width=0) (actual time=0.015..0.016 rows=1 loops=1)

90. 410.113 410.113 ↑ 1.5 1,789 1

GroupAggregate (cost=12,647.41..14,818.81 rows=2,606 width=191) (actual time=277.677..410.113 rows=1,789 loops=1)

91. 2,842.831 2,842.831 ↓ 93.6 716,337 1

Materialize (cost=0.00..106,204.65 rows=7,651 width=72) (actual time=0.036..2,842.831 rows=716,337 loops=1)

92. 1,232.832 1,232.832 ↓ 5.2 2,852 1

Sort (cost=15,376.67..15,378.04 rows=550 width=233) (actual time=1,230.016..1,232.832 rows=2,852 loops=1)

93. 65.891 65.891 ↓ 7.3 1,459 1

Sort (cost=5,455.75..5,456.25 rows=200 width=63) (actual time=64.852..65.891 rows=1,459 loops=1)

94. 3,064.975 3,064.975 ↓ 15.9 4,685 1

Subquery Scan on refills_1 (cost=8,081.08..8,090.67 rows=295 width=48) (actual time=3,052.822..3,064.975 rows=4,685 loops=1)

95. 87,145.712 87,145.712 ↓ 4.0 4 2,852

Bitmap Heap Scan on form_metadata meta_1 (cost=141.21..142.25 rows=1 width=14) (actual time=30.546..30.556 rows=4 loops=2,852)

96. 0.000 0.000 ↓ 0.0 0

Hash (cost=0.04..0.04 rows=3 width=32) (never executed)

97. 0.000 0.000 ↓ 0.0 0

Index Scan using form_metadata_reported on form_metadata meta_2 (cost=0.46..8,421.37 rows=8,420 width=50) (never executed)

98. 0.041 0.041 ↑ 1.0 1 1

Index Scan using pat_health_center_expr_idx8 on pat_health_center pat_health_center_1 (cost=0.29..2.32 rows=1 width=736) (actual time=0.041..0.041 rows=1 loops=1)

99. 276.246 276.246 ↓ 0.0 0 894

Nested Loop (cost=2.22..8.87 rows=1 width=652) (actual time=0.309..0.309 rows=0 loops=894)

100. 11.378 11.378 ↑ 1.0 3 11,378

Values Scan on ""*VALUES*"" (cost=0.00..0.04 rows=3 width=32) (actual time=0.001..0.001 rows=3 loops=11,378)

101. 3,068.703 3,068.703 ↓ 4.8 957 1

GroupAggregate (cost=8,081.08..8,098.57 rows=200 width=64) (actual time=3,052.831..3,068.703 rows=957 loops=1)

102. 412.880 412.880 ↑ 1.5 1,789 1

Materialize (cost=12,647.41..14,851.38 rows=2,606 width=191) (actual time=277.680..412.880 rows=1,789 loops=1)

103. 1,313.483 1,313.483 ↓ 5.2 2,852 1

Merge Left Join (cost=20,832.42..20,838.06 rows=550 width=257) (actual time=1,294.888..1,313.483 rows=2,852 loops=1)

104. 3,211.255 3,211.255 ↑ 10.7 716,337 1

Nested Loop (cost=0.01..259,215.53 rows=7,651,000 width=80) (actual time=0.054..3,211.255 rows=716,337 loops=1)

105. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=0.53..8,449.29 rows=516 width=36) (never executed)

106. 0.000 0.000 ↓ 0.0 0

Index Scan using useview_postnatal_care_count_reported_uuid on useview_postnatal_care pnc_1 (cost=0.44..140.85 rows=151 width=35) (never executed)

107. 998.374 998.374 ↓ 0.0 0 893

Index Scan using useview_postnatal_reported_chw_patient_id on useview_postnatal_care pnc (cost=0.44..10.49 rows=1 width=0) (actual time=1.118..1.118 rows=0 loops=893)

108. 277.140 277.140 ↓ 0.0 0 894

Nested Loop (cost=2.51..11.20 rows=42 width=0) (actual time=0.310..0.310 rows=0 loops=894)

109. 87,179.936 87,179.936 ↑ 1.0 1 2,852

Nested Loop Semi Join (cost=141.21..142.32 rows=1 width=0) (actual time=30.568..30.568 rows=1 loops=2,852)

110. 3,445.424 3,445.424 ↓ 1.4 6,241 1

HashAggregate (cost=316,598.03..316,673.51 rows=4,313 width=52) (actual time=3,444.155..3,445.424 rows=6,241 loops=1)

111. 3,069.525 3,069.525 ↓ 4.8 957 1

Materialize (cost=8,081.08..8,101.07 rows=200 width=64) (actual time=3,052.834..3,069.525 rows=957 loops=1)

112. 1,737.249 1,737.249 ↓ 5.2 2,852 1

Merge Left Join (cost=33,479.83..35,729.91 rows=550 width=409) (actual time=1,572.577..1,737.249 rows=2,852 loops=1)

113. 88,500.412 88,500.412 ↑ 1.0 1 2,852

Index Only Scan using contactview_chp_uuid on contactview_chp chp (cost=0.29..156.64 rows=1 width=40) (actual time=31.031..31.031 rows=1 loops=2,852)

114. 4,814.253 4,814.253 ↓ 5.2 2,852 1

Merge Left Join (cost=41,560.92..43,835.35 rows=550 width=433) (actual time=4,625.420..4,814.253 rows=2,852 loops=1)

115. 3,446.011 3,446.011 ↓ 1.4 6,241 1

Subquery Scan on eligible_women (cost=316,598.03..316,716.64 rows=4,313 width=52) (actual time=3,444.157..3,446.011 rows=6,241 loops=1)

116. 3,447.373 3,447.373 ↓ 1.4 6,240 1

Hash (cost=316,716.64..316,716.64 rows=4,313 width=52) (actual time=3,447.373..3,447.373 rows=6,240 loops=1)

117. 93,331.628 93,331.628 ↓ 5.2 2,852 1

Nested Loop Left Join (cost=41,561.20..129,996.75 rows=550 width=437) (actual time=4,656.715..93,331.628 rows=2,852 loops=1)

118. 96,793.240 96,793.240 ↓ 5.2 2,852 1

Hash Left Join (cost=358,342.54..446,782.34 rows=550 width=473) (actual time=8,104.110..96,793.240 rows=2,852 loops=1)

119. 96,809.053 96,809.053 ↓ 5.2 2,852 1

Sort (cost=446,807.38..446,808.75 rows=550 width=473) (actual time=96,808.729..96,809.053 rows=2,852 loops=1)

Planning time : 18.323 ms