Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatial index support via Pg12 support request API #378

Closed
wants to merge 39 commits into from

Conversation

pramsey
Copy link
Member

@pramsey pramsey commented Feb 28, 2019

Using the support request API it is possible to add index support to functions without recourse to SQL inlining. So, we can add an "overlaps" index condition to the plan for a query that has ST_Intersects in the WHERE or JOIN clause, invisibly, by implementing an appropriate "support function".

A side effect of moving to this means of activating indexes is allowing us to re-cost functions with higher cost, but without causing index failures due to inlining failing, as we have seen in the past.

Komzpa
Komzpa previously requested changes Feb 28, 2019
postgis/gserialized_supportfn.c Outdated Show resolved Hide resolved
postgis/gserialized_supportfn.c Show resolved Hide resolved
@Algunenano
Copy link
Member

Wow, i was tracking this but i missed it getting merged upstream.

Do you mind keeping this open for a few days / a week so I can have a look and setup some tests, please?

A side effect of moving to this means of activating indexes is allowing us to re-cost functions with higher cost, but without causing index failures due to inlining failing, as we have seen in the past.

With this I'm all for updating the cost of all functions and telling people they should use PG12 for proper cost.

OTOH, lately I've been thinking about how could Postgres support costs based on input (for example St_Area costs 5*avg points per geometry in input table squared). Do you know if there is something like that in the horizon (either for PG12 or 13) where we can help/push?

@pramsey
Copy link
Member Author

pramsey commented Feb 28, 2019

Yes, dynamic costing is available now

https://github.com/postgres/postgres/blob/4598a99cf22de0dbab975d9c87ce16fd53146aca/src/include/nodes/supportnodes.h#L131-L143

However, in order to be truly dynamic I think we'd need to enhance our stats tables to not only store grids of feature density but also grids of vertex density. Or even just save a single slot for the average vertices/feature. Or I guess maybe there's already enough data available in the stats slot... (object size and number of objects)... can you tell I haven't looked at the stats system in a while?

robe2
robe2 previously requested changes Mar 1, 2019
postgis/gserialized_supportfn.c Show resolved Hide resolved
@pramsey
Copy link
Member Author

pramsey commented Mar 2, 2019

@strk I really need your help figuring out exactly what st_function(geometry,geometry) is causing the topology failures... something that breaks it down to an actual "these inputs are returning an incorrect answer" situation. I cannot tease that out of topology. https://travis-ci.org/postgis/postgis/jobs/500590893#L2870

postgis/geography_measurement.c Outdated Show resolved Hide resolved
postgis/gserialized_supportfn.c Show resolved Hide resolved
@pramsey pramsey closed this Mar 6, 2019
@pramsey pramsey deleted the svn-trunk-supportfn branch April 26, 2019 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants