[postgis-users] selectivity

strk strk at keybit.net
Tue Nov 2 07:13:14 PDT 2010

On Mon, Nov 01, 2010 at 04:18:30PM -0700, Ben wrote:
> hello --
> i am not a postgis user, but i am interested in range datatypes and gist indexing.  there are some extensions for postgresql which expose such types (temporal, cube, etc.) but as far as i can tell all of them use the default geometric operator selectivity functions, which are all stubs in mainline postgresql and return hard-coded constants -- not ideal.
> i've been investigating postgis and it appears that you have real selectivity functions for your operators.
> 1 - is this true?  do they work well?  which operators work?  (&&, @>, etc)?

True. Work well. You can evaluate by using 'explain analyze <query>'
which gives you estimated and actual number of rows.
Only && is implemented custom (geometry_gist_sel) altought gathered
stats might be helpful for implementing more.

> 2 - is there any documentation describing how they work (besides the source code)?  i'm interested in the kind of statistics you use.

You may find something in postgis-devel archives
around early 2005. Me and Mark Cave involved.
Code should have interesting comments too.

> 3 - would it be possible for someone to backport the selectivity functions to, say, temporal postgres or cube?  would you recommend it?

Sure, why not.


  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html

More information about the postgis-users mailing list