Amazon has brought global secondary indexes to its non-relational, rentable DynamoDB database.
The upgrade means cloud wranglers can perform more complicated queries on data stored in the system without having to sacrifice latency. It achieves this by implementing Global Secondary Indexes (GSIs) – a feature that lets admins create additional indexes for the system.
Amazon introduced Local Secondary Indexes (LSIs) in September, which gave admins the ability to locally partition their DynamoDB instance to have up to five additional indexes to use for queries, letting them avoid costly scatter-gather operations and instead run data mining against cached indexes.
Standard DynamoDB splits a data table into attributes, which are roughly analogous to columns. The first two attributes form the
hash and the
range, and DynamoDB lets you query against either the hash, or the hash and the range.
This lets you fire off queries like 'Show us everything by Team Register [hash]', or using a hash key with a range key, eg 'Show me the ten most recent articles [range] by Team Register [hash]', but more complex queries are difficult.
Now both LSIs and GSIs let admins add in up to five additional indexes, so you can ask more complicated questions like 'Show us the ten most recent articles by Team Register with more than 10 comments that reference LOHAN'.
"With global secondary indexes in DynamoDB, you can now have many indexes and tune their capacity independently. These indexes also provide query/cost flexibility, allowing a custom level of clustering to be defined per index. Developers can specify which attributes should be 'projected' to the secondary index, allowing faster access to often-accessed data, while avoiding extra read/write costs for other attributes," writes Amazon's chief technology officer Werner Vogels in a blog post describing the change.
The rollout of Global Secondary Indexes follows a major price cut of the service by Amazon in May in response to the launch of Google's own Cloud Datastore, and the launch of an offline capability in September to help road-warrior developers test out apps built on the system without having to be online.
Though Amazon's storage (S3) and compute services (EC2) are reckoned to make a shedload of cash, the company has a need to get more sticky data into its cloud to protect against competitors like Windows Azure and Google Compute Engine. Though GSIs are a useful feature, they also encourage cloudy database developers to architect applications for AWS's specific way of doing things – which though not lock-in, does make the Amazon cloud harder to leave. ®