I want to get the all items of the last 24 hours. I've already done some google searches and it seems that it isn't easy to do with DynamoDB.
I was thinking if it is possible to create an secondary index with a common hash key and a timestamp field as sort key. Therefore, I could query on the timestamp with condition timestamp > (DateTime.Now - 24h). Can somebody comment on this if it is a possible way or has another idea?
Actually, I only need items in my table that are not older than 24 hours. So another idea would be to clean the table every hour and delete all items older than 24 hours. Is this possible?
EDIT: Another idea would be to create a secondary index with date as hash key and time as sort key, and then execute two queries. The first for date = 'today' and the second for date = 'yesterday' with condition on time. But how would I store the date and time, as string or integer? Would this be better than my idea above?