Merge Join (cost=20263749.67..23400036.21 rows=145914 width=182) Merge Cond: (("outer"."?column16?" = "inner"."?column8?") AND ("outer"."?column17?" = "inner"."?column9?")) Join Filter: ((("inner"."startDate")::date < ("outer"."startDate")::date) AND (NOT (subplan))) -> Sort (cost=20007230.88..20008096.76 rows=346352 width=154) Sort Key: ("Action"."jurorId")::integer, ("Action"."juryYear")::bpchar -> Index Scan using "Action_pkey" on "Action" (cost=0.00..19959126.27 rows=346352 width=154) Index Cond: (("countyNo")::smallint = 40) Filter: ((("actionCode")::bpchar <> 'APOOL'::bpchar) AND (("actionCode")::bpchar <> 'RPOOL'::bpchar) AND (("actionCode")::bpchar <> 'APAN'::bpchar) AND (("actionCode")::bpchar <> 'RPAN'::bpchar) AND (("actionCode")::bpchar <> 'MPOOL'::bpchar) AND (("actionCode")::bpchar <> 'MPAN'::bpchar) AND (("actionCode")::bpchar <> 'PR'::bpchar) AND (("actionCode")::bpchar <> 'JPP'::bpchar) AND (("actionCode")::bpchar <> 'MFROM'::bpchar) AND (("actionCode")::bpchar <> 'MNEXT'::bpchar) AND (subplan) AND ((("poolId" IS NULL) AND (subplan)) OR (("panelId" IS NULL) AND (subplan)))) SubPlan -> Index Scan using "Action_juror" on "Action" a1 (cost=0.00..3.53 rows=1 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("countyNo")::smallint = ($0)::smallint) AND (("juryYear")::bpchar = ($1)::bpchar) AND (("jurorId")::integer = ($2)::integer) AND (("actionSeqNo")::integer < ($3)::integer)) Filter: ((("actionCode")::bpchar = 'APAN'::bpchar) OR (("actionCode")::bpchar = 'MPAN'::bpchar)) -> Index Scan using "Action_juror" on "Action" a1 (cost=0.00..3.53 rows=1 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("countyNo")::smallint = ($0)::smallint) AND (("juryYear")::bpchar = ($1)::bpchar) AND (("jurorId")::integer = ($2)::integer) AND (("actionSeqNo")::integer < ($3)::integer)) Filter: ((("actionCode")::bpchar = 'APOOL'::bpchar) OR (("actionCode")::bpchar = 'MPOOL'::bpchar)) -> Index Scan using "JuryControl_pkey" on "JuryControl" jc (cost=0.00..3.73 rows=1 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("countyNo")::smallint = ($0)::smallint)) Filter: (("juryYear")::bpchar = ($1)::bpchar) -> Sort (cost=256518.79..257440.01 rows=368487 width=50) Sort Key: (a2."jurorId")::integer, (a2."juryYear")::bpchar -> Bitmap Heap Scan on "Action" a2 (cost=146515.97..214531.75 rows=368487 width=50) Recheck Cond: ((((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'APOOL'::bpchar)) OR ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'RPOOL'::bpchar)) OR ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'APAN'::bpchar)) OR ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'RPAN'::bpchar)) OR ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'MPOOL'::bpchar)) OR ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'MPAN'::bpchar))) AND (("countyNo")::smallint = 40)) -> BitmapAnd (cost=146515.97..146515.97 rows=49313 width=0) -> BitmapOr (cost=131912.40..131912.40 rows=397687 width=0) -> Bitmap Index Scan on "Action_juror" (cost=0.00..21985.40 rows=159054 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'APOOL'::bpchar)) -> Bitmap Index Scan on "Action_juror" (cost=0.00..21985.40 rows=15599 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'RPOOL'::bpchar)) -> Bitmap Index Scan on "Action_juror" (cost=0.00..21985.40 rows=140235 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'APAN'::bpchar)) -> Bitmap Index Scan on "Action_juror" (cost=0.00..21985.40 rows=51602 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'RPAN'::bpchar)) -> Bitmap Index Scan on "Action_juror" (cost=0.00..21985.40 rows=15599 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'MPOOL'::bpchar)) -> Bitmap Index Scan on "Action_juror" (cost=0.00..21985.40 rows=15599 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionCode")::bpchar = 'MPAN'::bpchar)) -> Bitmap Index Scan on "Action_pkey" (cost=0.00..14603.32 rows=1821233 width=0) Index Cond: (("countyNo")::smallint = 40) SubPlan -> Index Scan using "Action_juror" on "Action" a3 (cost=0.00..3.56 rows=1 width=176) Index Cond: ((("countyNo")::smallint = 40) AND (("countyNo")::smallint = ($0)::smallint) AND (("countyNo")::smallint = ($5)::smallint) AND (("juryYear")::bpchar = ($1)::bpchar) AND (("juryYear")::bpchar = ($6)::bpchar) AND (("jurorId")::integer = ($2)::integer) AND (("jurorId")::integer = ($7)::integer)) Filter: (((("actionCode")::bpchar = 'APOOL'::bpchar) OR (("actionCode")::bpchar = 'RPOOL'::bpchar) OR (("actionCode")::bpchar = 'APAN'::bpchar) OR (("actionCode")::bpchar = 'RPAN'::bpchar) OR (("actionCode")::bpchar = 'MPOOL'::bpchar) OR (("actionCode")::bpchar = 'MPAN'::bpchar)) AND (("startDate")::date < ($4)::date) AND (("startDate")::date >= ($8)::date) AND ((("startDate")::date > ($8)::date) OR (("actionSeqNo")::integer > ($9)::integer))) (42 rows)