[postgis-users] 3D index in postgis
pramsey at cleverelephant.ca
Tue May 20 09:54:26 PDT 2008
On Tue, May 20, 2008 at 8:40 AM, Kevin Neufeld <kneufeld at refractions.net> wrote:
> a1001800 wrote:
>> Thanks Kevin,
>> It looks like ~= not invoke the index.
> That's why I suggested the && operator as well. It does use the index.
>> Do we have a way to deal with an index with third value?
>> For example, point (x, y) and userid
>> I need to do a query like "select point(x,y) from table where point in
>> rectangle and userid=xxx"
> Sure. Add the userid=xxx to your filter list like you were doing.
> SELECT ST_MakePoint(x,y)
> FROM mytable
> WHERE geom && <insert rectangle geom here>
> AND userid = xxx;
> You can additionally add an ST_Contains() filter if you need to have
> your points exactly inside the rectangle.
No, don't do that :) "point && rectangle" is logically the same as
"st_contains(rectangle, point)" and somewhat cheaper.
The key is knowing for 100% sure that your polygonal geometry will
*always* be a rectangle. If there's a chance it won't, you need the
More information about the postgis-users