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

Utilize spatial queries to retrieve gyms within SCAN_AREA on raidscan init #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hokiepokedad2
Copy link

@hokiepokedad2 hokiepokedad2 commented Sep 27, 2018

Currently, on RaidScan.init, all forts are retrieved from the database and are checked to see if they are within the SCAN_AREA polygon/boundaries. For implementations where there is a large number of forts in the database, this process proved to be excruciatingly slow and took near 45 minutes to begin control for approximately 47k forts.

Spatial queries will instead be used to retrieve forts ONLY within the SCAN_AREA polygon/boundaries. Depending on how large the SCAN_AREA is, startup went from ~45 minutes to about 5 seconds.

For PostgreSQL implementations, please install PostGIS and create the extension for your monocle database (https://postgis.net/).

MySQL implementations should support spatial queries natively.

@hokiepokedad2 hokiepokedad2 changed the title Utilize spatial queries in PostGIS to retrieve gyms within SCAN_AREA on raidscan init Utilize spatial queries to retrieve gyms within SCAN_AREA on raidscan init Sep 27, 2018
@imp3tus
Copy link

imp3tus commented Sep 27, 2018

Just tested this PR on a MySQL DB, and it works perfectly. what took more than 2hrs for 45k gyms, now only takes less than 30 seconds.

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.

3 participants