I've been put in a position where I have to use DynamoDB at my company, even though I think traditional relational databases would be a better fit for our projects. Most of our projects are small and honestly don't require the scalability that DynamoDB provides. I'm trying to figure out the best way to perform searches and filters across the whole table. I know basic searches can be done using the Scan function, but it's pretty limited and case sensitive. My team isn't keen on using OpenSearch due to its cost. Does anyone have suggestions for how to approach searching in DynamoDB without breaking the bank?
5 Answers
Keep in mind that DynamoDB is primarily a key-value store and it doesn’t handle fuzzy searching very well. The best practice is to avoid using the Scan operation as it can get costly. Pairing DynamoDB with Athena or OpenSearch is typically recommended for more extensive searches. If you’re doing more frequent searches, OpenSearch may actually be the way to go despite the costs; it depends on your specific use case.
If you know which fields you'll filter on, consider setting up a Global Secondary Index (GSI). That way, you can perform a query against specific attributes. But keep in mind, you still need to know the exact value you're filtering by since DynamoDB is not designed for broad search capabilities.
I’ve had great experiences with using open-source solutions like TypeSense instead of expensive services like Algolia. It performs really well, even with millions of records. But, I get the challenge with needing a serverless setup in your case.
For better search capabilities, think about exporting your DynamoDB data to S3 and using AWS Athena. You can run SQL queries on the exported data, which can give you a lot more flexibility with searching.
You should definitely check the official DynamoDB documentation for guidance! They offer a free tier, which means if your usage is low, you could use it without incurring costs. Plus, being serverless, DynamoDB avoids the overhead of managing a dedicated SQL server. But don't forget to focus on producing your work. If you're convinced there's a better solution, gather strong evidence to support your case later instead of just complaining.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux