0
0
Redisquery~30 mins

Denormalization for speed in Redis - Mini Project: Build & Apply

Choose your learning style9 modes available
Denormalization for Speed in Redis
📖 Scenario: You are building a simple online store database using Redis. To make product information retrieval faster, you want to denormalize data by storing product details and their category names together.
🎯 Goal: Create Redis data structures to store products and categories separately, then denormalize by adding category names directly into product hashes for faster access.
📋 What You'll Learn
Create Redis hashes for categories with exact IDs and names
Create Redis hashes for products with exact IDs and names
Add a configuration variable for the category ID to denormalize
Update the product hash to include the category name for the given category ID
💡 Why This Matters
🌍 Real World
Denormalization in Redis is used in real online stores and apps to speed up reading product data by storing related info together.
💼 Career
Understanding denormalization helps database engineers and backend developers optimize performance in fast data systems.
Progress0 / 4 steps
1
Create category hashes
Create two Redis hashes with keys category:1 and category:2. Set the field name to "Electronics" for category:1 and "Books" for category:2.
Redis
Need a hint?

Use the HSET command to create hashes with the field name.

2
Create product hashes
Create two Redis hashes with keys product:101 and product:102. Set the field name to "Smartphone" for product:101 and "Novel" for product:102. Also set the field category_id to 1 for product:101 and 2 for product:102.
Redis
Need a hint?

Use HSET with multiple fields to add product name and category ID.

3
Set category ID to denormalize
Create a Redis string key called denormalize_category_id and set its value to 1 to indicate which category ID to denormalize.
Redis
Need a hint?

Use the SET command to store the category ID to denormalize.

4
Denormalize category name into product hash
For the product with key product:101, add a new field category_name and set its value to the category name from category:1 (which is "Electronics").
Redis
Need a hint?

Use HSET to add the category_name field to the product hash.