Working with DynamoDB Local and Global Indexes

Get Started
30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this lab, we will explore DynamoDB Local and Global Secondary Indexes, and their impact on performance and capacity unit usage.

An existing unindexed table is provided, and we will create a new table with Local and Global secondary indexes. Load the same dataset into our new table with a provided data loader, then use a test utility to observe the performance and capacity differences when performing read operations against tables with and without indexes.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a new table with Local and Global Secondary Indexes.

Log in to the AWS Web Console for the lab environment at the provided URL with the supplied credentials.

Note: Use the us-east-1 region for this lab.

Create a new DynamoDB Table named album_indexed with a Partition Key of artist_id and a Sort Key of id. Add a Local Secondary Index for the format attribute, and create a Global Secondary Index for the title attribute.

Login to the provided EC2 instance, and use the provided utility to load data into your newly create table.

Log in to the provided EC2 instance with the provided IP and credentials.

Run the index_table_load command to load data into your table.

Verify table contents and test querying against the indexes you’ve created.

Return to the AWS Web Console and verify that data has been loaded to the album_indexed table. Test querying against the title and format indexes.

Run the provided test utility and observe the results.

Return to the provided EC2 instance, run the provided pineheadrecords_query command, observe the results of the scan/filter against the album table, and query against the album_indexed table.

Additional Resources

Note: Use the us-east-1 region for this lab.

The client that our company has a contract with has launched its online vinyl record store. Unfortunately, several read operations are proving slow and expensive after the migration from MySQL to DynamoDB. The company has requested that we test the impact of Local and Global Secondary Indexes for the dataset. Two operations are particularly problematic, and the development team down the hall has created a test utility that performs the troublesome Scan/Filter operations against the existing album table. They've also written query functions that, when an album_indexed table is present, are performed against that table while assuming there is a Local Secondary Index on the format attribute and a Global Secondary Index on the title attribute. The client is hoping that the cost and performance of returning all albums of a specific format by a specified artist and returning data from the table by album title will improve through the addition of Secondary Indexes.

Once the table has been created with the partition key of artist_id and sort key of id, as well as a Local Secondary Index on the format attribute and a Global Secondary Index on the title attribute, we will load data into the table from the provided EC2 instance with the following command:

index_table_load

Then run the provided test utility with the following command:

pineheadrecords_query
What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?