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

[server]: optimise database query of finding nearby location #4

Open
abhijithvijayan opened this issue Dec 21, 2019 · 1 comment
Open
Assignees
Labels
breaking change effort: high more than a week help wanted Issue with a clear description that the community can help with. 💡 Proposed Work This is work that _might_ be worth doing, but that hasn't been started yet. status: assigned status: WIP Work in progress ... inputs welcome! ❤️ type: bug An issue or pull request relating to a bug in this project type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change

Comments

@abhijithvijayan
Copy link
Owner

Currently, when a user searches for route between 2 points

  1. Backend requests to Google Maps API to get routes to destination from source.
  2. Select a route and iterate through the points in between
    1. select the 3000m nearby point from current point
    2. query 1500m distant node aqi value from the selected point
  3. return results to the user with all the points and curresposing aqi values.

This model is inefficient considering the number of database queries for a single user request.

Suppose the user's path has 2 routes and one route has 8 points in between with 4 selectable points(with 3000m distance in between) including source and destination.
It takes 4 database queries to find nearest aqi node value.

Also the same for second route.

Refactor this to query the database in a single session and then return the results

@abhijithvijayan abhijithvijayan added bug help wanted Issue with a clear description that the community can help with. labels Dec 21, 2019
@abhijithvijayan abhijithvijayan changed the title refactor: database query of nearby location refactor: database query of finding nearby location Dec 21, 2019
@abhijithvijayan abhijithvijayan added breaking change effort: high more than a week status: assigned status: WIP Work in progress ... inputs welcome! ❤️ type: bug An issue or pull request relating to a bug in this project type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change 💡 Proposed Work This is work that _might_ be worth doing, but that hasn't been started yet. and removed bug labels Jan 13, 2020
@abhijithvijayan abhijithvijayan self-assigned this Jan 13, 2020
@abhijithvijayan abhijithvijayan changed the title refactor: database query of finding nearby location [server]: database query of finding nearby location Feb 24, 2020
@abhijithvijayan abhijithvijayan changed the title [server]: database query of finding nearby location [server]: optimise database query of finding nearby location Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change effort: high more than a week help wanted Issue with a clear description that the community can help with. 💡 Proposed Work This is work that _might_ be worth doing, but that hasn't been started yet. status: assigned status: WIP Work in progress ... inputs welcome! ❤️ type: bug An issue or pull request relating to a bug in this project type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change
Projects
None yet
Development

No branches or pull requests

1 participant