Merge Join (cost=13718290070.98..23823398394.05 rows=11456 width=182) Merge Cond: (("outer"."?column17?" = "inner"."?column8?") AND ("outer"."?column18?" = "inner"."?column9?")) Join Filter: ((("inner"."startDate")::date < ("outer"."startDate")::date) AND (NOT (subplan))) -> Sort (cost=13717984139.80..13717984200.52 rows=24289 width=162) Sort Key: ("Action"."jurorId")::integer, ("Action"."juryYear")::bpchar -> Nested Loop (cost=3.76..13717982370.58 rows=24289 width=162) -> HashAggregate (cost=3.76..3.77 rows=1 width=10) -> Index Scan using "JuryControl_pkey" on "JuryControl" jc (cost=0.00..3.75 rows=1 width=10) Index Cond: (("countyNo")::smallint = 40) -> Index Scan using "Action_pkey" on "Action" (cost=0.00..13717982074.61 rows=23377 width=154) Index Cond: ((("Action"."countyNo")::smallint = 40) AND (("Action"."juryYear")::bpchar = ("outer"."juryYear")::bpchar)) 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 ((("poolId" IS NULL) AND (subplan)) OR (("panelId" IS NULL) AND (subplan)))) SubPlan -> Bitmap Heap Scan on "Action" a1 (cost=6591.32..212610.04 rows=51213 width=14) Recheck Cond: ((("countyNo")::smallint = 40) AND (("actionSeqNo")::integer < ($0)::integer)) Filter: ((("actionCode")::bpchar = 'APAN'::bpchar) OR (("actionCode")::bpchar = 'MPAN'::bpchar)) -> Bitmap Index Scan on "Action_pkey" (cost=0.00..6591.32 rows=625386 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionSeqNo")::integer < ($0)::integer)) -> Bitmap Heap Scan on "Action" a1 (cost=6591.32..212610.04 rows=67335 width=14) Recheck Cond: ((("countyNo")::smallint = 40) AND (("actionSeqNo")::integer < ($0)::integer)) Filter: ((("actionCode")::bpchar = 'APOOL'::bpchar) OR (("actionCode")::bpchar = 'MPOOL'::bpchar)) -> Bitmap Index Scan on "Action_pkey" (cost=0.00..6591.32 rows=625386 width=0) Index Cond: ((("countyNo")::smallint = 40) AND (("actionSeqNo")::integer < ($0)::integer)) -> Sort (cost=305931.18..306929.78 rows=399440 width=50) Sort Key: (a2."jurorId")::integer, (a2."juryYear")::bpchar -> Bitmap Heap Scan on "Action" a2 (cost=15080.55..260185.90 rows=399440 width=50) Recheck Cond: (("countyNo")::smallint = 40) 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)) -> Bitmap Index Scan on "Action_pkey" (cost=0.00..15080.55 rows=1876158 width=0) Index Cond: (("countyNo")::smallint = 40) SubPlan -> Bitmap Heap Scan on "Action" a3 (cost=15080.55..278947.48 rows=1110 width=14) Recheck Cond: (("countyNo")::smallint = 40) 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 < ($7)::date) AND (("startDate")::date >= ($8)::date) AND ((("startDate")::date > ($8)::date) OR (("actionSeqNo")::integer > ($9)::integer))) -> Bitmap Index Scan on "Action_pkey" (cost=0.00..15080.55 rows=1876158 width=0) Index Cond: (("countyNo")::smallint = 40) (36 rows)