Best Database Choice for Geospatial Queries with Multiple Filters

0
8
Asked By TechieTurtle77 On

Hey there! I'm developing an app that primarily uses DynamoDB for data storage, all managed via Lambda functions. I've hit a bit of a snag with one particular use case: I need to perform proximity searches for items by their latitude and longitude, letting users filter within a specific radius (like 10 km) alongside other criteria (like creation date, object type, or target age). Given that DynamoDB operates best with a single partition/sort key configuration, this is proving to be a challenge.

I've looked into using a geohash as a sort key, but it's a balancing act:
- A shorter geohash leads to fewer partitions to query but requires filtering out lots of results that fall outside the radius.
- A longer geohash offers better accuracy but means querying several adjacent hash keys for the desired area.

I also thought about creating a separate 'query table' in a different database that holds the attributes I need (latitude, longitude, etc.) along with the DynamoDB IDs. I could query this table without the constraints of DynamoDB, and then use BatchGetItem to retrieve the complete records from DynamoDB.

So, my main question is: what's the most cost-effective database approach to handle geospatial queries with multiple filters? Should I consider a specific database for this scenario, or can I make DynamoDB work for this use case despite its limitations? Thanks for any guidance!

3 Answers

Answered By DataDynamo92 On

For your situation, RDS PostgreSQL with PostGIS could be a solid option. It supports index-enhanced nearest-neighbor queries, making your searches much more efficient. You might even be able to operate on a smaller instance since you'd be using it primarily as an index into DynamoDB, which means less storage for rows.

TechieTurtle77 -

Thanks for the advice! I'll definitely check it out.

Answered By LinkNinja On

Here are some useful links to explore different database options:
- AWS Database Products: https://aws.amazon.com/products/databases/
- AWS RDS: https://aws.amazon.com/rds/
- AWS DynamoDB: https://aws.amazon.com/dynamodb/
- AWS Aurora: https://aws.amazon.com/aurora/
- AWS Redshift: https://aws.amazon.com/redshift/
- AWS DocumentDB: https://aws.amazon.com/documentdb/
- AWS Neptune: https://aws.amazon.com/neptune/

Answered By GeoWizard101 On

You might want to look into H3 tesselations as an alternative to your current geohash approach. It allows you to adjust the precision by modifying the hexagon size, which could better suit your needs.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.