Ian Short
Ian Short

Reputation: 59

DocumentDB Spatial - Request Rate is large

So, my collection contains 25,000 points and 15,000 polygons. I guess the polygons are fairly large, most of the worlds land mass is covered.

The points are coming back fine. The first polygon in the collection comes back fine, when i do a query like:

SELECT TOP 2 * FROM c.features[0] f WHERE (f.geometry.type='Polygon' OR f.geometry.type='MultiPolygon') AND ST_WITHIN({'type':'Point','coordinates':[26.35, 31.00]}, f.geometry)

If I use different coordinates for this query, I am getting a "Request Rate is large" message, try again after a few seconds.

Does DocumentDB not deal well with spatial queries on a large collection of polygons?

Edit1: Query takes 1157.53 RUs, and the current pricing tier is S1 so 250RUS...I may see my problem!

Edit2: So I updated the collection to S2, then S3. RUS were going up to 11,000, and I'm still getting "Request Rate is Large". What can be done? The documents are about 50kb in size, 15,000 of them. Doesn't seem like a lot to me

Edit3: I am completely flummoxed as to why, if I change the coordinates by 1 degree, the query fails.

Edit4: Selecting by ID comes back at 3.49RU. Select by asking, is a point inside a polygon...over 11,000. Is this normal? If it is, is DocumentDB suitable for anything other than storing and querying point data?

Thanks

Upvotes: 1

Views: 189

Answers (1)

David Makogon
David Makogon

Reputation: 71055

So... per edit: Given that your spatial query RU cost is ~1000 RU, and you're at a 250RU tier... the first query gets honored, but then you're in a "deficit" state (you basically ate up your RU allocation for about ~4 seconds). And that explains why you're throttled for a short bit of time.

Upvotes: 1

Related Questions