New answers tagged json
A lot depends on how much traffic you expect to see and how often this situation will occur. To avoid premature optimization, I'd first go with a variation of your 2nd choice - treat the duplicate request as an error (and log it as such). If you see it happening often enough to warrant action, then your 1st choice - cache the output - seems reasonable. ...
Assuming you don't have an immediate need to query over those JSON fields, then there's nothing wrong with this approach, so long as the performance hit of deserializing/serializing isn't a problem for your program. Later on, let's say the requirement comes in to order/filter based on that "sales_rank" JSON field. You'd write a program to run over the data ...
It is sometimes a better fit for the application to store a complete document as one entity. It is not a coincidence that nosql and document databases are on the rise. If you are aware of the drawbacks it can be an ok approack but you should also consider a real document database instead of inventing your own.
Top 50 recent answers are included