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

Performance Improvement for Street and Neighborhood APIs #3494

Closed
misaugstad opened this issue Feb 20, 2024 · 0 comments · Fixed by #3516
Closed

Performance Improvement for Street and Neighborhood APIs #3494

misaugstad opened this issue Feb 20, 2024 · 0 comments · Fixed by #3516
Labels

Comments

@misaugstad
Copy link
Member

misaugstad commented Feb 20, 2024

Brief description of problem/feature

For the Access Score Street/Neighborhood APIs, on the back end, we are actually grabbing all labels within the bounding box specified in the query parameters. This can mean querying for way more labels than are necessary. We should update our queries to only get labels that are relevant to the streets/neighborhoods requested.

I believe that this was done to keep things more simple; we get to just reuse the same query we use for the Attributes API. But it's causing some performance problems. And in rare cases (in the Streets API) it can mean missing out on a couple labels on margins.

I believe that the changes should look something like:

  1. For the Streets API, get the list of streets in the bounding box, then join the streets with the label table, since each label has a street_edge_id denoting the closest street to that label.
  2. For the Neighborhoods API, we could either do an intersection in the same way (region -> street_edge_region -> label tables), or we could do a geographic intersection between the geometries in the region and label tables. I'm not super picky on which we choose.
  3. Either way, I believe that we could potentially reuse some SQL code. Maybe this means building the query in getGlobalAttributesInBoundingBox(). And/or it might mean reusing the queries in selectStreetsIntersecting() and getNeighborhoodsWithin().
@misaugstad misaugstad added the API label Feb 20, 2024
@misaugstad misaugstad changed the title Improvement for Street and Neighborhood APIs Performance Improvement for Street and Neighborhood APIs Feb 23, 2024
@misaugstad misaugstad mentioned this issue Mar 14, 2024
@misaugstad misaugstad moved this to done / on test servers in Mikey Task Board May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: done / on test servers
Development

Successfully merging a pull request may close this issue.

1 participant