Questions tagged [amazon-dynamodb-index]
251 questions
1
vote
2 answers
DynamoDB costs for Scan vs Query (with GSI which partition key is the same for the whole table) for filtering
I have a DynamoDB table which looks like this:
[id] [datetime] [name] [reasonForVisit] [__typename]
[id] is the simple primary key for the table
[__typename] is an attribute that has the same value for all items in the table
The table has become…

Yao Jenn
- 55
- 6
1
vote
1 answer
Querying main table vs scanning secondary index in DynamoDB
If I have a DynamoDB table with pk and sk where pk is such that I can query the table for a given pk and get all items in a given category, how does this differ from scanning a sparse secondary index that contains only items from said category? I…

Wuubb
- 71
- 6
1
vote
2 answers
Query a DynamoDB table to get all the items having a flag value as true
I have a DDB table with hash key as id (string) and sort key as flag (boolean). I want to get all the items in the table which has flag value of true. I have not setup any GSI or LSI but I can create them if required.
Schema
{
"id": {
"S":…

PankajTekwani
- 61
- 5
1
vote
1 answer
Can we update a fetch a record and update the Primary key attribute in DynamoDB?
Let's say we have a DynamoDB record with Primary Key: A1 and GSI (Hash Key: B1 and RangeKey: C1).
And we have the following records in the database:
A1 B1 C1
--------------------------
value1 value2 value3
value4 value5 …

Anirudh Mergu
- 119
- 1
- 9
1
vote
1 answer
Is there a better way to model this access pattern than to use two global secondary indexes (GSI)?
I'm trying to figure out the data model and access patterns for an app keeping track of animal movements between different fields (pastures). There are movement records that look like this:
PK FROM TO …

beevor
- 131
- 1
- 6
1
vote
1 answer
How to query on more than 2 attributes in DynamoDB using GSI?
I have a use-case where i have to query on more than 2 attributes on dynamoDB table. As far as I know, we can only query for upto 2 attributes(partition key, sort key) on DDB table using GSI. is there anything which allows us to query on multiple…

Akash Patel
- 189
- 1
- 5
- 13
1
vote
1 answer
is there any impact in performance when we need to access last sort key for any particular partition key
I am creating a dynamoDB table. I am using an custromerId as partition key and versionNumber as sort key. suppose there are 1000 versions for any particular customerId. for my use-case I always want to find out last version of any customerId. will…

Akash Patel
- 189
- 1
- 5
- 13
1
vote
1 answer
How can I define an efficient range query based on a DynamoDB composite sort key?
With composite sort keys it is possible to define hierarchical (one-to-many) relationships in data that can be queried at any level of the hierarchy.
For example, in a table listing geographical locations, the sort key could be structured as…

niklr
- 1,671
- 3
- 24
- 40
1
vote
2 answers
Why does the following dynamoDB write with conditional expression succeeds?
I have the following code to create a dynamoDB table :
def create_mock_dynamo_table():
conn = boto3.client(
"dynamodb",
region_name=REGION,
aws_access_key_id="ak",
aws_secret_access_key="sk",
)
…

Sourav Sarkar
- 406
- 1
- 5
- 14
1
vote
1 answer
Dynamodb Query/Scan nested documents. Specifying GSI
I have following structure of the DynamoDb document
{
"studentName"(PK): "Ben",
"studendId": 123,
"UpdatedTimestamp"(SortKey): 1221432432
"Subjects": [
{
SubjectName: "Math"
SubjectMarks: 80
UpdatedTimeStamp: …

stackaccount
- 79
- 4
1
vote
1 answer
DynamoDB query using OR and beginsWith
First of all, I am aware that we cannot use the OR operator inside the KeyConditionExpression.
I am storing my I18n keys in the database and I have the following data structure:
{
"de": "Key in German",
"en": "Key in English",
"pk_id":…

Juan Rivillas
- 897
- 2
- 9
- 23
1
vote
0 answers
Dynamodb - Query global secondary index for multiple range values
I have on a table a global secondary index with hash and range keys.
I want to fetch in a single query entries with a specific hash key and a certain list of possible range values.
I tried this, but getting an…

dor.elmaliach
- 515
- 5
- 14
1
vote
0 answers
DynamoDB table size
I'm developing a DynamoDB table housing salary data by zip code. Here's the structure of my table:
For a given zip code, there will be a Sort Key called Meta which houses lat/lon, city, state, county, etc. In addition to Meta, I will have values…

Tom Schreck
- 5,177
- 12
- 68
- 122
1
vote
0 answers
AWS Update Item error - UpdateItem operation: The provided key element does not match the schema
I am trying to update a dynamodb table in AWS which has two keys. One column "col1" is the Hash key and the column "col2" is the range key. It has no GSIs.
In addition to col1, and col2, there are two columns col3 and col4 which are not indexes but…

goutam
- 657
- 2
- 13
- 35
1
vote
0 answers
QueryAsync DynamoDB with Index (Partition Key and Short Key) .Net Core
Net Core project that using DynamoDB. They have ScanAsync and QueryAsync. I have no problem using ScanAsync but I read that the performance of Query is better so I want to use QueryAsync instead. I set up indexes with both Partition and Short Key.…

Hector
- 21
- 4