Does DynamoDB support secondary indexes?

Yes. DynamoDB supports two kinds of secondary indexes. A Global Secondary Index (GSI) has its own partition/sort key and capacity (20 per table by default, eventually consistent). A Local Secondary Index (LSI) shares the table's partition key with a different sort key, supports strong consistency, and must be defined at table creation.

Global Secondary Index (GSI)

  • Its own partition and sort key, independent of the table's.
  • Its own provisioned throughput (or on-demand capacity).
  • Eventually consistent reads only.
  • Add or remove any time; default quota of 20 per table.

A GSI is how you look items up by an attribute outside the table's primary key.

Local Secondary Index (LSI)

  • Shares the table's partition key, with a different sort key.
  • Shares the table's throughput.
  • Supports strongly consistent reads.
  • Must be created at table creation and cannot be added later.

The two differences you can measure

A GSI read does not quietly downgrade when you ask for strong consistency. It fails:

ValidationException: Consistent reads are not supported on global secondary indexes
HTTP 400

The same query with ConsistentRead: true against an LSI succeeds, and reports ConsumedCapacity 1.0 where the eventually consistent read of the same item reports 0.5. Strong consistency is available on an LSI, at twice the read units.

The second difference is on writes, and it is the one that shows up on the bill. Putting one identical 920-byte item into three tables that differ only in how many GSIs they carry:

0 GSIs   ConsumedCapacity 1   table 1
1 GSI    ConsumedCapacity 2   table 1, gsi1 1
2 GSIs   ConsumedCapacity 3   table 1, gsi1 1, gsi2 1

Every GSI that projects a changed attribute is another write you pay for. AWS states the rule the numbers show: the write cost is "the sum of write capacity units consumed by writing to the base table and those consumed by updating the global secondary indexes". A KEYS_ONLY projection is how you keep that second write small.

Choosing between them

Reach for a GSI for new access patterns and flexibility; reach for an LSI when you need strong consistency on an alternate sort within the same partition.

Go deeper

Compare them in GSI vs LSI and see index projections. Download DynoTable to query through your indexes.

References

Last verified 2026-07-13 against the official AWS documentation linked above; quotas re-checked 2026-07-28.

The error string and the ConsumedCapacity values were captured 2026-07-28 against DynamoDB Local 3.3.0 via @aws-sdk/client-dynamodb 3.1095.0 and are the engine's own output.

Work with DynamoDB without the Console

A fast DynamoDB desktop client that runs the real SQL DynamoDB can’t — JOINs, GROUP BY, aggregates — with visual editing and an AI agent on your own Bedrock keys.

Free 30-day trial, no credit card — then the Free plan with no time limit.