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

Reorganize SQL for place search using window functions #3383

Merged
merged 5 commits into from
Apr 3, 2024

Conversation

lonvia
Copy link
Member

@lonvia lonvia commented Apr 2, 2024

When searching for a place, Nominatim needs to look up the names in the search_name table and at the same time some further properties that restrict search in the placex table. Since looking up full and partial names at the same time, the initial result set has become a lot larger, thus creating a lot more IO accesses.

This PR rearranges the query: Nominatim does first the lookup in the search_name table, already computing the penalty for how well a word matches and the uses SQL windowing to throw away most of the results that have a lower importance/matching factor than the best result. The placex table is joined only after that, so that significantly less rows need to be retrieved from there.

Also increases radius when restricting search by postcode.

@lonvia lonvia merged commit 657aae5 into osm-search:master Apr 3, 2024
11 checks passed
@lonvia lonvia deleted the window-searches branch April 3, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant