पाठ 14 / 28

DynamoDB एक नज़र में

DynamoDB tables, partition व sort keys और on-demand capacity से key-value व document data किसी भी scale पर रखें।

Serverless NoSQL database

DynamoDB fully managed NoSQL database है जिसमें reads और writes एक अंकीय milliseconds में होते हैं। आप partition key (और वैकल्पिक sort key) के आसपास table design करते हैं और उन्हीं keys से query करते हैं। Capacity on-demand (प्रति request भुगतान) या provisioned हो सकती है।

Items डालना और query करना

पहले अपने access patterns के लिए design करें: partition key से query तेज़ है, जबकि पूरी table scan धीमी और महँगी है।

aws dynamodb put-item --table-name Orders \
  --item '{"customerId":{"S":"c42"},"orderId":{"S":"o1001"},"total":{"N":"499"}}'

aws dynamodb query --table-name Orders \
  --key-condition-expression "customerId = :c" \
  --expression-attribute-values '{":c":{"S":"c42"}}'

कई अलग values वाली partition key चुनें ताकि load समान रूप से बँटे। जब access patterns ज्ञात हों तब DynamoDB और जब लचीले joins व ad hoc queries चाहिए तब RDS उपयोग करें।

त्वरित जाँच

त्वरित जाँच: DynamoDB query items जल्दी खोजने के लिए क्या उपयोग करता है?

  • The partition key (and sort key)
  • A full table scan
  • SQL joins
  • The AMI id
Answer

The partition key (and sort key) — Key से queries तेज़ हैं; scans पूरी table पढ़ते हैं।