Y :resdom { RESDOM :resno 1 :restype 25 :restypmod -1 :resname <> :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { VAR :varno 2 :varattno 2 :vartype 25 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 2}} { TARGETENTRY :resdom { RESDOM :resno 2 :restype 23 :restypmod -1 :resname <> :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { VAR :varno 2 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 1}}) :qpqual <> :lefttree <> :righttree <> :extprm () :locprm () :initplan <> :nprm 0 :scanrelid 2 :indxid ( 364042) :indxqual (({ EXPR :typeOid 16 :opType op :oper { OPER :opno 96 :opid 65 :opresulttype 16 } :args ({ VAR :varno 2 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 1} { VAR :varno 65001 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2})})) :indxqualorig (({ EXPR :typeOid 16 :opType op :oper { OPER :opno 96 :opid 65 :opresulttype 16 } :args ({ VAR :varno 2 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 1} { VAR :varno 65001 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2})})) :indxorderdir 0 } :extprm () :locprm () :initplan <> :nprm 3 :jointype 0 :joinqual <>} psql:test.sql:7: NOTICE: QUERY PLAN: Nested Loop (cost=1080959.35..1081029.79 rows=1 width=32) -> Hash Join (cost=1080959.35..1081026.76 rows=1 width=20) -> Hash Join (cost=1080958.24..1081025.64 rows=2 width=16) -> Subquery Scan operprim (cost=1080953.53..1081014.79 rows=1225 width=24) -> Unique (cost=1080953.53..1081014.79 rows=1225 width=24) -> Sort (cost=1080953.53..1080953.53 rows=12251 width=24) -> Hash Join (cost=13.19..1080121.64 rows=12251 width=24) -> Nested Loop (cost=0.00..1079863.42 rows=12251 width=12) -> Nested Loop (cost=0.00..37120.12 rows=3267 width=8) -> Seq Scan on inst (cost=0.00..1.09 rows=9 width=4) -> Seq Scan on oper (cost=0.00..29.26 rows=726 width=4) SubPlan -> Index Scan using operrole_pkey on operrole (cost=0.00..5.63 rows=1 width=12) -> Seq Scan on prim (cost=0.00..1.15 rows=15 width=4) SubPlan -> SetOp Except (cost=10.67..10.68 rows=1 width=20) -> Sort (cost=10.67..10.67 rows=5 width=20) -> Append (cost=0.00..10.62 rows=5 width=20) -> Subquery Scan *SELECT* 1 (cost=0.00..7.76 rows=1 width=20) -> Nested Loop (cost=0.00..7.76 rows=1 width=20) -> Index Scan using operrole_pkey on operrole (cost=0.00..5.63 rows=1 width=8) -> Seq Scan on roleattr (cost=0.00..1.45 rows=45 width=12) -> Subquery Scan *SELECT* 2 (cost=2.79..2.86 rows=4 width=12) -> Merge Join (cost=2.79..2.86 rows=4 width=12) -> Sort (cost=1.59..1.59 rows=3 width=4) -> Seq Scan on primattr (cost=0.00..1.56 rows=3 width=4) -> Sort (cost=1.20..1.20 rows=8 width=8) -> Seq Scan on imply (cost=0.00..1.08 rows=8 width=8) -> SetOp Except (cost=10.50..10.51 rows=1 width=28) -> Sort (cost=10.50..10.50 rows=4 width=28) -> Append (cost=0.00..10.46 rows=4 width=28) -> Subquery Scan *SELECT* 1 (cost=0.00..1.56 rows=3 width=4) -> Seq Scan on primattr (cost=0.00..1.56 rows=3 width=4) -> Subquery Scan *SELECT* 2 (cost=7.76..8.89 rows=1 width=28) -> Hash Join (cost=7.76..8.89 rows=1 width=28) -> Seq Scan on imply (cost=0.00..1.08 rows=8 width=8) -> Hash (cost=7.76..7.76 rows=1 width=20) -> Nested Loop (cost=0.00..7.76 rows=1 width=20) -> Index Scan using operrole_pkey on operrole (cost=0.00..5.63 rows=1 width=8) -> Seq Scan on roleattr (cost=0.00..1.45 rows=45 width=12) -> Hash (cost=12.35..12.35 rows=335 width=12) -> Seq Scan on class (cost=0.00..12.35 rows=335 width=12) -> Hash (cost=4.70..4.70 rows=1 width=4) -> Index Scan using oper_id_key on oper (cost=0.00..4.70 rows=1 width=4) -> Hash (cost=1.11..1.11 rows=1 width=4) -> Seq Scan on inst (cost=0.00..1.11 rows=1 width=4) -> Index Scan using class_pkey on class (cost=0.00..3.01 rows=1 width=12) EXPLAIN