[postgis-devel] Re: geometry stats
m.cave-ayland at webbased.co.uk
Wed Feb 25 04:10:32 PST 2004
Fantastic! A 'working' implementation of the stats collector already :)
> Taking a look at the code it seems the the index overlap
> function is box_overlap taken from external source, while
> sequencial scan uses geometry_overlap(). It might be better
> to get the full control over geometry operations (they might
> have changed something inthe box containment funx).
Yeah I think this has been well discussed already (see the thread
The way to test this would to be to try your same && query firstly using
the index scan on a small number of tuples and verifying the results.
Then peform the same query after typing SET ENABLE_SEQSCAN = 'f' and
compare the results. If they are different then the implementation of
box_overlap() is not the same as geometry_overlap() and this could be
the problem you are seeing. I must admit that I would be quite surprised
if the overlap() operator were broken this late in the game.
Looking at the comments in postgis_estimate.c, do you really get
different query results when uncommenting your 'selectivity = 0.9'? Is
this true if you try different values, say from 0.1 to 0.9?
I suppose the other possibility is that some memory is being overwritten
where it shouldn't be. I've had another quick look at your new code and
the only thing I've noticed at first sight is that PostgreSQL passes
float4 values by reference(!) and not by value which may cause the
get_attstatlot()/free_attrstatslot() not to handle memory as they
should. Then again I would expect this to have been more likely to seg
fault rather than upset the query....
Also, Tom is correct in that the selectivity returned only affects the
choice of the planner and not the number of tuples returned.
I'm currently working to tight deadlines (both in and out of work) which
means I don't have as much time as I like to experiment with this. I
hope that in a week's time I shall have time to look at this in more
Tamar Science Park
Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.
More information about the postgis-devel