Have you ever needed to evolve your read patterns without losing efficiency? Maybe your app started with one access pattern, but now you need three, and the queries that don’t hit your partition key are getting slower and more expensive every month. We built global secondary indexes (GSIs) for exactly this, and today we’re thrilled to announce they’re generally available in Azure Cosmos DB! A GSI is an automatically synced copy of your data with a different partition key, so you can query it efficiently for more read patterns.
The problem GSI solves
Azure Cosmos DB scales by distributing data across physical partitions. When your queries include the partition key, the SDK routes them directly to the right partition: fast, cheap, and consistent no matter how large your dataset grows. But real-world apps rarely stay simple. You might partition users by email for login, then realize you also need to look them up by phone number. An e-commerce app might partition orders by customer ID, then need to query by order ID for fulfillment.
Every query that doesn’t include the partition key fans out across all partitions, and the cost can add up fast. More data means more partitions, which means more fan-out, higher RU charges, and slower responses. At scale, these cross-partition queries can cost 10x or more compared to a targeted single-partition read.
Historically, the workaround was to duplicate your data into a second container with a different partition key. You’d wire up a change feed processor, write the sync logic, handle retries and failures in your application code, and provision compute to host it all. It worked, but it was real engineering overhead you had to build, pay for, and maintain yourself.
One of our customers, Woven, made the transition from self-managing their own secondary index to leveraging GSIs in production. It simplified their application while keeping their queries efficient.
“Woven handles real-time messaging for frontline deskless teams across thousands of locations. Cosmos DB GSI gave us an additional access pattern to our message data without the code and compute overhead we would otherwise have to manage. That kind of capability, built into the service instead of bolted on via application code, is exactly what we love about being cloud native with Cosmos DB in Azure.”
— Tim Schoenfeld, CTO, Woven
GSI means you don’t have to choose between expensive cross-partition queries and complex custom plumbing. Your cross-partition queries become targeted single-partition lookups, and Azure Cosmos DB handles the sync for you.
When to use GSI
- Alternative lookups. Your source container is optimized for one access pattern, but your app needs several. GSI gives each pattern its own partition key so every query stays fast and cheap.
- AI and agentic apps. Agents need flexible query patterns on user data, session state, and conversation history that shift as your app evolves. GSI lets you add new access patterns without refactoring your data model.
- Workload isolation. GSI containers have their own throughput and indexing policy, so you can add vector or full-text search indexes without affecting your transactional workload. Your point reads stay fast on the source while search queries run against an optimized, independently scaled index.
- Evolving access patterns. New query patterns emerge as your application grows. GSI lets you add them without remodeling your containers.
See it in action
Want to try it yourself? Clone the GSI demo app, load 200,000 sample order records, and run the same queries against both your source container and GSI container to see the RU and latency differences firsthand.
Get started
To get started, follow the steps to configure global secondary indexes. Enable continuous backup on your account, turn on the GSI feature, and create your first GSI container from the Azure Portal or CLI! We recommend autoscale throughput for GSI containers to handle sync traffic spikes smoothly.
What will you build?
GSI makes multi-access-pattern workloads simpler and cheaper: no custom sync code, no extra infrastructure, no compromise on query performance. We’re excited to see what you build with it! Try it today and share your experience with us.
0 comments
Be the first to start the discussion.