DynamoDB query response time improvements? Should I add Global Secondary Index (GSI) to my table?

89 views Asked by At

I am new to the DynamoDB and I have a situation where my existing table looks like this -

enter image description here

I have an API that uses from_date and end_date (only date without timestamp) as filters to find records between two given dates and the only date column I have in my dynamoDB table is m_time (which is date with time upto seconds). Now the API response is slower in some cases maybe on some dates there are more records because of which I am thinking maybe the query is taking more time because the m_time column has date and time and my input dates that I am passing are only having date WITHOUT time, so should I add a global secondary index ( GSI) with a new column that has only date without time ? Is there any way I can parse existing m_time column to only date without adding a new column ? What are my possible options? Is even adding a GSI with date only column will help me in this case?

The current primary key has - id as Partition key and m_time as sort key.

1

There are 1 answers

0
Leeroy Hannigan On

You don't share the query you make. But regardless of your value having time and the input not, it's still efficient as it's just lexicographically sorted. You evaluate and read only the items you require.

But you should share your Query to be sure.