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

Query timeout on sophox.org #36

Open
Jan-Kiezun opened this issue Dec 12, 2024 · 1 comment
Open

Query timeout on sophox.org #36

Jan-Kiezun opened this issue Dec 12, 2024 · 1 comment

Comments

@Jan-Kiezun
Copy link

Jan-Kiezun commented Dec 12, 2024

Hello, I am trying to use the sophox.org service but it seems to work really slow and some queries take such a long time that a timeout occurs. For example the following request gets stuck at 2.5mb of data and then waits for a timeout:

https://sophox.org/#SELECT%20%3Fitem%20%3FitemLabel%20WHERE%20%7B%0A%7B%0A%3Fitem%20osmt%3Aplace%20%3FplaceType%20.%0AFILTER%20%28%3FplaceType%20IN%20%28%22city%22%2C%20%22town%22%2C%20%22village%22%29%29%0A%7D%0A%7D

The end of request data looks cut off and then a log starts as following:

image

@1ec5
Copy link
Member

1ec5 commented Dec 12, 2024

A couple tips for optimizing your query:

  • You have an extra pair of curly braces, which means there’s a subquery for no particular reason.
  • Avoid FILTER if you can express the constraint using triples. If you need to match multiple predicates, use a property path. If you need to match multiple objects, use a VALUES statement. If you need to match multiple completely different predicates and objects, use a UNION statement. A FILTER needs to be evaluated somewhat manually on each individual result, whereas these other syntaxes take advantage of the fact that OSM data is stored in a triplestore.

That said, with 1,781,999 elements in OSM that match these criteria, it seems to be too much for even this optimized query. Blazegraph, the engine that powers Sophox, has known performance issues with high volumes of data like this, though I’m unsure about the specific cause in this particular case.

For what it’s worth, QLever is able to return these results within a split second. That engine stores OSM data differently, so you’d need to tweak your query slightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants