Parse GeoPoint request is slow and timeout using javascript sdk in node.js

I have the following parsing request that expires when the number of records is large.

var query = new Parse.Query("UserLocation");
query.withinMiles("geo", geo, MAX_LOCATION_RADIUS);
query.ascending("createdAt");

if (createdAt !== undefined) {
    query.greaterThan("createdAt", createdAt);
}
query.limit(1000);

      

it works fine if the UserLocation table is small. But the query time is from time to time when the table has ~ 100k records:

[2015-07-15 21:03:30.879] [ERROR] [default] - Error while querying for locations: [latitude=39.959064, longitude=-75.15846]: {"code":124,"message":"operation was slow and timed out"}

      

The UserLocation table has a latitude, longitude, and radius pair. Given a geographic point (latitude, longitude), I am trying to find a list of UserLocations whose circle (lat, long) + radius covers the given geo point. I can't seem to use a value from another column in the table to query the distance (something like query.withinMiles("geo", inputGeo, "radius")

where "geo" and "radius" are the column names for the GeoPoint and radius). It also has the limitation that the "limit" query combined with "skip" can return a maximum of 10,000 records (1000 records at a time and skip 10 times). So I had to do a near full scan of the table using "createdAt" as the filter criterion and continuing the query until the query returned no more results.

Is there anyway I can improve the algorithm so that it doesn't fall out on a large dataset?

+3
node.js parse.com


source to share


No one has answered this question yet

Check out similar questions:

1092
How to get GET variables (query string) in Express.js on Node.js?
890
How do I parse JSON using Node.js?
499
Read a file one line at a time in node.js?
334
JavaScript, Node.js: Array.forEach is asynchronous?
4
How to create a geospatial module with AWS lambda and dynamo db
3
Parse.Query.each () not including all records
0
Group by sum of total request using parsing cloud code
0
Android Retrofit ParseSdk Geopoint
0
Parse: Composite Request for Follower Timeouts
-1
How to query on an array of objects in parsing



All Articles
Loading...
X
Show
Funny
Dev
Pics