Skip to content

DynamoDB

sanglt1902 edited this page Jul 13, 2019 · 2 revisions

When making a query, the partition key is used to identify the exact node the data resides on before filtering the rest of the query. This has powerful implications. As your data grows, if your partitions are well distributed, it means your requests will be just as fast regardless of how much data is in your table. A query can be made on the partition key by itself, or you may provide a sort key to help further limit the items returned. The sort key serves two purposes: sorting and searching. You can do a partial search on a sort key, unlike a partition key which must be a full match. The sort key can be used to sort your items by ascending or descending order. One limitation of DynamoDB is that the sort key is one of the only ways to sort your data. You cannot sort on every attribute. More on that with indexes. In addition, you can only have one partition key and one sort key per base table.

BatchGetItems

  • Mỗi truy vấn tối đa là 16M dữ liệu, tối đa là 100 items
  • BatchGetItems sẽ trả về từng phần dữ liệu nếu vượt quá giới hạn response, vượt quá throughput, hoặc khi đọc dữ liệu bị lỗi.
  • Khi BatchGetItems trả về 1 phần dữ liệu thì sẽ kèm theo UnprocessedKeys => dựa vào đó ta có thể query lại những dữ liệu mà chưa trả về

BatchWriteItem

  • Mỗi truy vấn ghi tối đa 16M, 25 request put hoặc delete, mỗi Item tối đa 400KB
  • Nếu vượt quá giới hạn throughput thì sẽ trả về UnprocessedItems để query lại
  • Cùng 1 request ko thể thay đổi dữ liệu cùng 1 Item BatchWriteItem không thể cập nhật theo từng field của Item (chỉ có thể tạo mới hoặc ghi đè). Để cập nhật Item sử dụng hành động **UpdateItem**

Clone this wiki locally