Dynamodb cost for index writes

1

Hey all,

I have an on-demand dynamodb table. It contains 5 local secondary indexes and 4 global secondary indexes.

Dynamodb charges per kb for writes. My base table attributes mostly deals with Boolean values. Which is about 200 bytes per write. So each and every index of my mine is less than 200 bytes.

My question is, when I write to the base table will I be charged for 10 different writes (10 kb) or based on total size (2 kb) ?

Thanks.

Vir2020
질문됨 4년 전840회 조회
2개 답변
1

A write unit is any write operation up to 1 KB. If none of your secondary indexes are sparse, then inserting an item into your table (the primary index) will result in an additional write unit consumed for each of your secondary indexes - total of 10. This is to propagate the record. Deleting the item from the primary index will also consume 10 write units.

One nuance regarding updates to the item in the primary index - if the attribute updated is part of the primary key for an index, then propagating the change to that index will consume 2 write units - one to delete the original propagated item in the index, and another to write a replacement with the new primary key for the index.

I would recommend testing some of this by making some writes to the table, and using the "ReturnConsumedCapacity" option - it will tell you how much throughput was consumed. It's a great way to get a feel for the efficiency of your design.

답변함 4년 전
0

Thanks for the ReturnConsumedCapacity option. That's what I was looking for.

Have a nice day.

Vir2020
답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인