DEV Community

Uzeyr OZ
Uzeyr OZ

Posted on

DynamoDB - Local Secondary Indexes and Global Secondary Indexes

Introduction:
DynamoDB is a NoSQL database provided by Amazon Web Services. One of the key features of DynamoDB is its ability to create indexes, which enable faster querying of data. In this article, we will discuss the two types of indexes available in DynamoDB - Local Secondary Indexes and Global Secondary Indexes.

Local Secondary Indexes (LSI) are indexes that use the same partition key as the original table but a different sort key. LSIs are created when the table is first created and can only be used for querying specific data columns.

Global Secondary Indexes (GSI) use a different partition key and sort key from the original table. This allows for a different view of the data and gives greater flexibility to the user as GSIs can be created at any time after the table is created.

Conclusion:
In conclusion, DynamoDB indexes provide a faster and more efficient way of querying data. LSIs are useful for specific data columns and must be created at the same time as the table, while GSIs offer greater flexibility as they can be created at any time and use different partition and sort keys. Understanding the differences between these two types of indexes is important in order to effectively utilize DynamoDB's capabilities.

🌎🙂😎 Let's Connect!
My Twitter: @muzeyrozcan
My Substack (here I will publish more in-depth articles)

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay