EXPLAIN ANALYZE VERBOSE SELECT asbinary(force_collection(force_2d(a.the_geom)),'NDR'),a.OID::text from infogis_admin a, test t WHERE (feat_type='GEMEINDE') and (t.the_geom && a.the_geom) Nested Loop (cost=42.12..49.20 rows=1 width=36) (actual time=1281.000..9640.000 rows=303 loops=1) Join Filter: ("inner".the_geom && "outer".the_geom) -> Nested Loop (cost=42.12..48.16 rows=1 width=36) (actual time=1281.000..9595.000 rows=303 loops=1) Join Filter: contains("outer".the_geom, "inner".the_geom) -> Subquery Scan b (cost=42.12..42.13 rows=1 width=32) (actual time=1265.000..1265.000 rows=1 loops=1) -> Aggregate (cost=42.12..42.12 rows=1 width=32) (actual time=1265.000..1265.000 rows=1 loops=1) -> Index Scan using idx_admingebiete_gid, idx_admingebiete_gid, idx_admingebiete_gid, idx_admingebiete_gid, idx_admingebiete_gid, idx_admingebiete_gid, idx_admingebiete_gid on admingebiete (cost=0.00..42.10 rows=7 width=32) (actual time=0.000..0.000 rows=7 loops=1) Index Cond: ((gid = 410) OR (gid = 422) OR (gid = 423) OR (gid = 424) OR (gid = 426) OR (gid = 427) OR (gid = 430)) -> Index Scan using geom_admingebiete on admingebiete a (cost=0.00..6.02 rows=1 width=36) (actual time=0.000..32.000 rows=641 loops=1) Index Cond: (a.the_geom && "outer".the_geom) Filter: ((feat_type)::text = 'GEMEINDE'::text) -> Seq Scan on test t (cost=0.00..1.01 rows=1 width=20) (actual time=0.000..0.000 rows=1 loops=303) Total runtime: 9656.000 ms QUERY PLAN {NESTLOOP :startup_cost 42.12 :total_cost 49.20 :plan_rows 1 :plan_width 36 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 17 :restypmod -1 :resname asbinary :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {FUNCEXPR :funcid 18105 :funcresulttype 17 :funcretset false :funcformat 0 :args ( {FUNCEXPR :funcid 18181 :funcresulttype 17984 :funcretset false :funcformat 0 :args ( {FUNCEXPR :funcid 18176 :funcresulttype 17984 :funcretset false :funcformat 0 :args ( {VAR :varno 65001 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 7 } ) } ) } {CONST :consttype 25 :constlen -1 :constbyval false :constisnull false :constvalue 7 [ 7 0 0 0 78 68 82 ] } ) } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 25 :restypmod -1 :resname oid :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {FUNCEXPR :funcid 114 :funcresulttype 25 :funcretset false :funcformat 1 :args ( {VAR :varno 65001 :varattno 2 :vartype 26 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno -2 } ) } } ) :qual <> :lefttree {NESTLOOP :startup_cost 42.12 :total_cost 48.16 :plan_rows 1 :plan_width 36 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 17984 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 65000 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 7 } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 26 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 65000 :varattno 2 :vartype 26 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno -2 } } ) :qual <> :lefttree {SUBQUERYSCAN :startup_cost 42.12 :total_cost 42.13 :plan_rows 1 :plan_width 32 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 17984 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 6 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 6 :varoattno 1 } } ) :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :scanrelid 6 :subplan {AGG :startup_cost 42.12 :total_cost 42.12 :plan_rows 1 :plan_width 32 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 17984 :restypmod -1 :resname the_geom :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {AGGREF :aggfnoid 18327 :aggtype 17984 :target {VAR :varno 0 :varattno 7 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 7 } :agglevelsup 0 :aggstar false :aggdistinct false } } ) :qual <> :lefttree {INDEXSCAN :startup_cost 0.00 :total_cost 42.10 :plan_rows 7 :plan_width 32 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 20 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 3 :varattno 2 :vartype 20 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 2 } } {TARGETENTRY :resdom {RESDOM :resno 3 :restype 1043 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 3 :varattno 3 :vartype 1043 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 3 } } {TARGETENTRY :resdom {RESDOM :resno 4 :restype 1043 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 3 :varattno 4 :vartype 1043 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 4 } } {TARGETENTRY :resdom {RESDOM :resno 5 :restype 1043 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 3 :varattno 5 :vartype 1043 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 5 } } {TARGETENTRY :resdom {RESDOM :resno 6 :restype 1043 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 3 :varattno 6 :vartype 1043 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 6 } } {TARGETENTRY :resdom {RESDOM :resno 7 :restype 17984 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 3 :varattno 7 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 7 } } ) :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :scanrelid 3 :indxid (o 120574 120574 120574 120574 120574 120574 120574) :indxqual (( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -102 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -90 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -89 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -88 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -86 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -85 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -82 1 0 0 ] } ) } )) :indxqualorig (( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -102 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -90 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -89 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -88 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -86 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -85 1 0 0 ] } ) } ) ( {OPEXPR :opno 96 :opfuncid 65 :opresulttype 16 :opretset false :args ( {VAR :varno 3 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 3 :varoattno 1 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ -82 1 0 0 ] } ) } )) :indxstrategy ((i 3) (i 3) (i 3) (i 3) (i 3) (i 3) (i 3)) :indxsubtype ((o 0) (o 0) (o 0) (o 0) (o 0) (o 0) (o 0)) :indxlossy ((i 0) (i 0) (i 0) (i 0) (i 0) (i 0) (i 0)) :indxorderdir 0 } :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :aggstrategy 0 :numCols 0 :numGroups 0 } } :righttree {INDEXSCAN :startup_cost 0.00 :total_cost 6.02 :plan_rows 1 :plan_width 36 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 17984 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 5 :varattno 7 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 7 } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 26 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 5 :varattno -2 :vartype 26 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno -2 } } ) :qual ( {OPEXPR :opno 98 :opfuncid 67 :opresulttype 16 :opretset false :args ( {RELABELTYPE :arg {VAR :varno 5 :varattno 4 :vartype 1043 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 4 } :resulttype 25 :resulttypmod -1 :relabelformat 0 } {CONST :consttype 25 :constlen -1 :constbyval false :constisnull false :constvalue 12 [ 12 0 0 0 71 69 77 69 73 78 68 69 ] } ) } ) :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :scanrelid 5 :indxid (o 120573) :indxqual (( {OPEXPR :opno 18056 :opfuncid 18046 :opresulttype 16 :opretset false :args ( {VAR :varno 5 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 7 } {VAR :varno 65001 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 6 :varoattno 1 } ) } )) :indxqualorig (( {OPEXPR :opno 18056 :opfuncid 18046 :opresulttype 16 :opretset false :args ( {VAR :varno 5 :varattno 7 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 7 } {VAR :varno 65001 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 6 :varoattno 1 } ) } )) :indxstrategy ((i 3)) :indxsubtype ((o 0)) :indxlossy ((i 1)) :indxorderdir 0 } :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :jointype 0 :joinqual ( {FUNCEXPR :funcid 18335 :funcresulttype 16 :funcretset false :funcformat 0 :args ( {VAR :varno 65001 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 6 :varoattno 1 } {VAR :varno 65000 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 7 } ) } ) } :righttree {SEQSCAN :startup_cost 0.00 :total_cost 1.01 :plan_rows 1 :plan_width 20 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 2 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 1 } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 17984 :restypmod -1 :resname <> :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } :expr {VAR :varno 2 :varattno 2 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 2 } } ) :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :scanrelid 2 } :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :jointype 0 :joinqual ( {OPEXPR :opno 18056 :opfuncid 18046 :opresulttype 16 :opretset false :args ( {VAR :varno 65000 :varattno 2 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 2 } {VAR :varno 65001 :varattno 1 :vartype 17984 :vartypmod -1 :varlevelsup 0 :varnoold 5 :varoattno 7 } ) } ) }