insert into property(property_id, the_geom) values(999, geometryfromtext( 'POLYGON((100 100, 200 100, 200 200, 100 200, 100 100))', 2992) ); select property_id, st_astext(the_geom) from property where property_id = 999; 999 | POLYGON((100 100,200 100,200 200,100 200,100 100)) insert into property(property_id, the_geom) values(1001, geometryfromtext( 'POLYGON( (100 100, 200 100, 200 200, 100 200, 100 100), (110 110, 150 110, 150 150, 110 150, 110 110))', 2992) ); insert into property(property_id, the_geom) values(1002, geometryfromtext( 'POLYGON( (100 100, 200 100, 200 200, 100 200, 100 100), (110 110, 180 110, 180 180, 110 180, 110 110), (160 160, 180 160, 180 180, 160 180, 160 160))', 2992) ); nrcs=# \d clu_parcel Table "public.clu_parcel" Column | Type | Modifiers -----------------+-------------------+---------------------------------------------------------- gid | integer | not null default nextval('clu_parcel_gid_seq'::regclass) statecd | character varying | countycd | character varying | calcacres | double precision | the_geom | geometry | comments | text | modified_date | date | modified_by | integer | land_manager_id | integer | Indexes: "clu_parcel_pkey" PRIMARY KEY, btree (gid) "clu_parcel_countycd_idx" btree (countycd) "clu_parcel_statecd_idx" btree (statecd) "clu_parcel_the_geom_gist_idx" gist (the_geom) Check constraints: "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2) "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL) "enforce_srid_the_geom" CHECK (srid(the_geom) = 2992) Foreign-key constraints: "clu_parcel_land_manager_id_fkey" FOREIGN KEY (land_manager_id) REFERENCES land_manager(land_manager_id) nrcs=# select count(*) from clu_parcel; count -------- 266193 explain analyze select gid, st_astext(the_geom) from clu_parcel where st_contains(the_geom, geometryfromtext('POINT(1994577 1209379)', 2992)); QUERY PLAN ------------------------------------ Seq Scan on clu_parcel (cost=0.00..22648.24 rows=88731 width=879) (actual time=508.587..31353.423 rows=1 loops=1) Filter: st_contains(the_geom, '0101000020B00B000000000000516F3E410000000023743241'::geometry) Total runtime: 31361.671 ms (3 rows) explain analyze select gid, st_astext(the_geom) from clu_parcel where the_geom && geometryfromtext('POINT(1994577 1209379)', 2992); QUERY PLAN ------------------------------- Index Scan using clu_parcel_the_geom_gist_idx on clu_parcel (cost=0.00..6.02 rows=1 width=879) (actual time=111.094..143.974 rows=3 loops=1) Index Cond: (the_geom && '0101000020B00B000000000000516F3E410000000023743241'::geometry) Filter: (the_geom && '0101000020B00B000000000000516F3E410000000023743241'::geometry) Total runtime: 151.158 ms (4 rows) explain analyze select gid, st_astext(the_geom) from clu_parcel where the_geom && geometryfromtext('POINT(1994577 1209379)', 2992) and st_contains(the_geom, geometryfromtext('POINT(1994577 1209379)', 2992)); Index Scan using clu_parcel_the_geom_gist_idx on clu_parcel (cost=0.00..6.02 rows=1 width=879) (actual time=1.662..4.579 rows=1 loops=1) Index Cond: (the_geom && '0101000020B00B000000000000516F3E410000000023743241'::geometry) Filter: ((the_geom && '0101000020B00B000000000000516F3E410000000023743241'::geometry) AND st_contains(the_geom, '0101000020B00B000000000000516F3E410000000023743241'::geometry)) Total runtime: 4.750 ms (4 rows)