[postgis-users] Incorrect row count estimation for 4D index

Oleg Mürk oleg.myrk at gmail.com
Fri Aug 3 03:06:58 PDT 2012


Hello,

I have a problem that Postgis 4D spatial indexes (built using
gist_geometry_ops_nd) do not estimate index lookup row count properly,
unlike 2D spatial indexes which are working OK.

The 2D query is something like:
	position && ST_GeomFromText('LINESTRING(-180 -90, 180 90)', 4326)
And 4D query is something like:
	position &&& ST_GeomFromText('LINESTRING(-180 -90 -10000000
-10000000, 180 90 -10000000 -10000000)', 4326)

In case of 2D query, query planner correctly understands that I am
selecting all points and avoids using the index.
In case of 4D, the result set is always estimated to be 10000 (out of
10M rows in total).

As a result of incorrect 4D query row estimation, query planner always
thinks that spatial query is highly selective and ignores other
indexes it might have used otherwise.

Is this a bug or am I missing something? I am using Postgis 2.0.1 on
Postgresql 9.1

Thanks,
Oleg



More information about the postgis-users mailing list