have you verified that
feedDate has the same data type in both the table and the Secondary Index?
could you please share the table and index details?
The feedDate is of type String in both cases. Now I am able to run scan and get the results but I am still not able to run a query. The query requires a partition key and my partition key are different item ids for each day.
Below are key elements of table and details on global secondary index: Partition key: itemID (String) Sort key: Batch (String) feedDate(String)
Global secondary index details Name feedDate-index Status Active Partition key feedDate (String) Sort key - Read capacity Range: 1 - 10; Auto scaling at 70%; Current provisioned units: 1 Write capacity Range: 1 - 10; Auto scaling at 70%; Current provisioned units: 1 Size 2.4 megabytes Item count 8527
DynamoDB is designed for quick LOOKUP using specific keys. It is not designed to be an analytical tool, even if you have options such as SCAN and QUERY. If you know that you need to provide aggregations (or any other type of analytical functions), it is better to either create aggregation tables in DDB or export the data through DynamoDB streams to an analytical tool such as Athena.
For example, every time that you put another record in your main table above, you can also increase a counter to a day-count table. See an example for such logic here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.03.html#GettingStarted.Python.03.04
You don't need to limit your LOOKUP to a single record, as you have the sort key to get a few records. However, if you see that you need to read hundreds or even dozens of records to generate a specific statistic such as count, max, mean, etc. you are using DynamoDB inefficiently.
Suggestion : Update multiple items based on a common queryAccepted Answerasked 3 years ago
How to use Amplify Datastore to sync with data from DynamoDB and seed DynamoDB from a Lambaasked 8 months ago
Delete records in Dynamodb without a TTLAccepted Answerasked 4 years ago
DynamoDB: Duplicate a lot of data to save a second lookup?asked 6 months ago
ConsistentRead with Local Secondary Index?asked 4 months ago
How do I define a SQLite expression in DynamoDB 'object-mapping' DMS migration task?asked 5 months ago
Secondary Index in DynamoDBasked 6 months ago
It does not insert all my requests into a DynamoDB table.Accepted Answerasked 8 months ago
NoSQL Workbench support for Local Secondary Indexes in Dynamodbasked a month ago
Visualizing Location data on a unique photo/area visualizationasked 8 months ago