3 ms·
DynamoDB is not meant for ad-hoc query patterns; as others have said, plan your indexes around your access patterns. However, so long as you add a global secon
by Jupe 5y ago
DynamoDB is not meant for ad-hoc query patterns; as others have said, plan your indexes around your access patterns.
However, so long as you add a global secondary index (GSI) with name, city as the key, you can certainly do such things. But be aware for large-scale solutions:
1. There's a limit of 20 GSIs per table. You can increase with a call to AWS support.
2. GSIs are latently updated; read-after write is not guaranteed, and there is no "consistent read" option on a GSI like there is with tables.
3. WCUs on GSIs should match (or surpass) the WCUs on the original table, else throughput limit exceeded exceptions will occur. So, 3 GSIs on a table means you pay 4x+ in WCU costs.
4. The keys of the GSI should be evenly distributed, just like the PK on a main table. If not, there is additional opportunity for hot partitions on write.
Ref: https://aws.amazon.com/premiumsupport/knowledge-center/dynamodb-gsi-throttling-table/ https://aws.amazon.com/premiumsupport/knowledge-center/dynam...