What’s the best database and caching solution for a simple read-only API?

0
1
Asked By CuriousCoder123 On

I'm developing a basic API that retrieves information based on a data structure that defines a 'Food' item, including its name, description, food type, and tags. This API will primarily be read-only, with infrequent updates. I need fast retrieval times as I'll be searching across these properties, and I'm considering whether to use a relational database like Postgres with a couple of tables or a NoSQL option like MongoDB. I'm also thinking about implementing caching since the data won't change much. I'm looking for recommendations on the database type and architecture to use between the API and the database, along with any resources that might help.

3 Answers

Answered By DatabaseDude42 On

Postgres is definitely a strong choice for this kind of project! It has great full-text search capabilities and is reliable for handling joins. You can index your food names and descriptions to make retrieval super fast. For caching, consider adding something like Caffeine or Redis, especially given that your data isn’t changing often. It’ll help speed things up by reducing the number of queries to your database.

Answered By LearningLover99 On

Using a relational database like Postgres is smart for your use case, especially since it's read-heavy. You’re right on track with considering caching, as that will help a lot with performance. If you map out your API and data flow before diving into implementation, it'll make the process smoother. Good luck!

Answered By TechSavvy88 On

I agree with the Postgres recommendation! Plus, with its support for vectorized full-text search, it can handle your search queries efficiently. If you set up proper indexing for your name and description fields, retrieval speed should be excellent. Caching with Redis is also a solid call; you can cache results of common searches to make the API feel snappier.

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.