---
title: "Comment by Mohit Yadav on \"How to model relational data in DynamoDB\" | Hashnode"
description: "Great to learn something! I&#39;m new to DynamoDB and still confused why you prepended project# and monitor# to some GSIs, this would increase the redundancy an"
url: "https://hashnode.com/posts/how-to-model-relational-data-in-dynamodb/622f167d38e0a0d99d32f083/comment/62368f71bef4c71aa6f10fb3"
---

[Discussion](https://hashnode.com/posts/how-to-model-relational-data-in-dynamodb/622f167d38e0a0d99d32f083)

Comment [How to model relational data in DynamoDB](https://hashnode.com/posts/how-to-model-relational-data-in-dynamodb/622f167d38e0a0d99d32f083)

[Mohit Yadav](https://hashnode.com/@just-moh-it)

[Mar 20, 2022](https://hashnode.com/posts/how-to-model-relational-data-in-dynamodb/622f167d38e0a0d99d32f083/comment/62368f71bef4c71aa6f10fb3)

Great to learn something! I'm new to DynamoDB and still confused why you prepended `project#` and `monitor#` to some GSIs, this would increase the redundancy and also unintentionally increase storage space.

Also, while querying, why do you query both, the primary key and the GSI, even though the schema says they contain the same data.

I might be totally getting the concept of GSIs wrong. Pardon me for that.

Thanks for the awesome and in-depth article 🎉

[Stefan Olaru](https://hashnode.com/@stefanolaru)

[Mar 21, 2022](https://hashnode.com/posts/how-to-model-relational-data-in-dynamodb/622f167d38e0a0d99d32f083/comment/62368f71bef4c71aa6f10fb3#reply-62380c8c8e4fae3f767e0842)

Hey [Mohit Yadav](https://hashnode.com/@just-moh-it), good question.

It's called index overloading. The table can hold many different kinds of data items at one time, hence we use generic names for primary key (PK), sort key (SK), and global secondary index (GSI).

Prefixing allows to identify the entity to be queried, e.g. user-related items will always have PK starting with _user#_, so on.

The GSIs help with certain access patterns, let's say we have items like: PK:project#1234|SK:project#1234|GSI:org#1234|attrs PK:project#4321|SK:project#4321|GSI:org#1234|attrs

We can get the project details using `GetItem`, but to `Query` all projects of an org we'll have to use the overloaded GSI like `GSI=org#1234 AND begins_with(SK, project#)`.

[Mohit Yadav](https://hashnode.com/@just-moh-it)

[Mar 21, 2022](https://hashnode.com/posts/how-to-model-relational-data-in-dynamodb/622f167d38e0a0d99d32f083/comment/62368f71bef4c71aa6f10fb3#reply-6238a691e6506757acb79c83)

Thanks for the in-depth answer, [Stefan](https://hashnode.com/@stefanolaru)!

Honestly speaking, I understand most of this, but some concepts are still a bit rusty... Explaining them may be out of the scope of this article, so I'll definitely learn them when I get into NoSQL DBs. 😃
