Database Reference
In-Depth Information
Making use of the sparse index
While inserting an item into the DynamoDB table, we must specify the primary key attrib-
utes, but it is not mandatory for an item to have the secondary attributes. If an item doesn't
contain secondary index attributes, then the item will not be available in the secondary in-
dex.
The previous table is the table that we use to explain the usage of sparse index. Our prob-
lem statement is to find out which author pair is more frequent. So for faster retrieval, we
are going to use the global secondary index with the Author attribute as hash and the
Author2 attribute as the range key. The previous table has five items. Our global second-
ary index will have how many attributes: five or three? The answer is three. Why?
An item's attributes will be projected only if the index's key values (hash and range) are
present in the item. This property is called sparse. This kind of index is called the sparse in-
dex. For these kinds of problem statements, the use of this kind of index will be beneficial
for retrieval of results as well as storage and insertion.
Search WWH ::




Custom Search