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 takes a major hit (presumably when you hit a geohash border) #38

Open
burggraf opened this issue Apr 18, 2019 · 2 comments
Open
Labels
bug Something isn't working

Comments

@burggraf
Copy link

I've been troubleshooting a nasty performance issue that seemed to occur randomly. That is, until I narrowed it down. Take the following example:

Searching for properties near Fontana, California.
If I search within a 4km radius, I get 408 results in about 2 seconds.
If I search within a 5km radius, I get 555 results in about 40 seconds.

Somewhere between 4km and 5km I'm hitting an invisible wall which makes the query 20x slower.

Here's the relevant code (I had profiling code in there to show the exact performance but I removed it for simplicity:

this.propertiesCollection = this.geo.collection('properties', ref =>
    ref.where('subtype', '==', 'Residential')
);
const center = this.geo.point(34.1087656, -117.5328097); // Fontana, California
const radius = 4;
this.propertiesCollection.within(center, radius, 'position').subscribe((results) => {
    this.properties = results;
});
@burggraf
Copy link
Author

If this is helpful:

  1. a radius of 4.89km takes 2 seconds to complete (as well as any radius below 4.98)
  2. a radius of 4.90km takes 40 seconds to complete (as well as any radius above 4.90)

@philipallfrey
Copy link

4.89km appears to be the changeover point from a 5 character to a 4 character geohash. See

case km <= 4.89:

@codediodeio codediodeio added the bug Something isn't working label Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants