default_statistics_target=500 (good plan) Merge Join (cost=36209583.45..93584000.61 rows=24889787 width=27) (actual time=0.057..0.057 rows=0 loops=1)" " Merge Cond: (av1.number_value = av_1.card_id)" " Join Filter: (SubPlan 2)" " -> Index Scan using xif8number_value on attribute_value av1 (cost=0.57..81759294.58 rows=548296097 width=23) (actual time=0.017..0.017 rows=1 loops=1)" " -> Sort (cost=12192441.38..12193162.13 rows=288300 width=37) (actual time=0.034..0.034 rows=0 loops=1)" " Sort Key: av_1.card_id" " Sort Method: quicksort Memory: 25kB" " -> Merge Join (cost=2820197.11..12166296.59 rows=288300 width=37) (actual time=0.027..0.027 rows=0 loops=1)" " Merge Cond: ((a_2.attribute_code)::text = (ao_1.attribute_code)::text)" " Join Filter: (SubPlan 1)" " -> Nested Loop (cost=2793472.67..12137623.79 rows=576600 width=65) (actual time=0.026..0.026 rows=0 loops=1)" " -> Merge Join (cost=46.31..46.35 rows=1 width=46) (actual time=0.025..0.025 rows=0 loops=1)" " Merge Cond: ((a_2.attribute_code)::text = (ao1.attribute_code)::text)" " -> Sort (cost=18.32..18.33 rows=1 width=21) (actual time=0.025..0.025 rows=0 loops=1)" " Sort Key: a_2.attribute_code" " Sort Method: quicksort Memory: 25kB" " -> Nested Loop (cost=1.11..18.31 rows=1 width=21) (actual time=0.009..0.009 rows=0 loops=1)" " -> Nested Loop (cost=0.84..13.02 rows=9 width=18) (actual time=0.009..0.009 rows=0 loops=1)" " -> Index Only Scan using card_and_status_idx on card c_2 (cost=0.56..8.58 rows=1 width=11) (actual time=0.008..0.008 rows=0 loops=1)" " Index Cond: (card_id = '0'::numeric)" " Heap Fetches: 0" " -> Index Only Scan using xpktemplate_block on template_block tb_1 (cost=0.28..4.38 rows=6 width=17) (never executed)" " Index Cond: (template_id = c_2.template_id)" " Heap Fetches: 0" " -> Index Scan using xif1attribute on attribute a_2 (cost=0.28..0.58 rows=1 width=27) (never executed)" " Index Cond: ((block_code)::text = (tb_1.block_code)::text)" " Filter: ((data_type = 'B'::bpchar) AND ((attribute_code)::text = ANY ('{JBR_IMPL_ONCONT,_STATE,ADMIN_290575,JBR_IMPL_RESOLUT,JBR_DOCL_RELATDOC,ADMIN_221237,JBR_REGD_REGNUM,JBR_REGD_DATEREG (...)" " -> Sort (cost=27.99..28.00 rows=4 width=25) (never executed)" " Sort Key: ao1.attribute_code" " -> Bitmap Heap Scan on attribute_option ao1 (cost=23.69..27.95 rows=4 width=25) (never executed)" " Recheck Cond: ((option_code)::text = 'UPLINK'::text)" " -> Bitmap Index Scan on xpkattribute_option (cost=0.00..23.69 rows=4 width=0) (never executed)" " Index Cond: ((option_code)::text = 'UPLINK'::text)" " -> Bitmap Heap Scan on attribute_value av_1 (cost=2793426.36..10801306.74 rows=133627070 width=23) (never executed)" " Recheck Cond: (number_value = '0'::numeric)" " -> Bitmap Index Scan on xif8number_value (cost=0.00..2760019.59 rows=133627070 width=0) (never executed)" " Index Cond: (number_value = '0'::numeric)" " -> Sort (cost=29.69..29.82 rows=49 width=25) (never executed)" " Sort Key: ao_1.attribute_code" " -> Bitmap Heap Scan on attribute_option ao_1 (cost=23.70..28.32 rows=49 width=25) (never executed)" " Recheck Cond: ((option_code)::text = 'LINK'::text)" " -> Bitmap Index Scan on xpkattribute_option (cost=0.00..23.69 rows=49 width=0) (never executed)" " Index Cond: ((option_code)::text = 'LINK'::text)"