amazon dynamodb - What is Hash and Range Primary Key? -


i not able understand range primary key here -

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workingwithtables.html#workingwithtables.primary.key

and how work?

what mean - "unordered hash index on hash attribute , sorted range index on range attribute"?

"hash , range primary key" means single row in dynamodb has unique primary key made of both hash , range key. example hash key of x , range key of y, primary key xy. can have multiple range keys same hash key combination must unique, xz , xa. let's use examples each type of table:

hash primary key – primary key made of 1 attribute, hash attribute. example, productcatalog table can have productid primary key. dynamodb builds unordered hash index on primary key attribute.

this means every row keyed off of value. every row in dynamodb have required, unique value attribute. unordered hash index means says - data not ordered , not given guarantees how data stored. you won't able make queries on unordered index such get me rows have productid greater x. write , fetch items based on hash key. example, get me row table has productid x. making query against unordered index gets against key-value lookups, fast, , use little throughput.


hash , range primary key – primary key made of 2 attributes. first attribute hash attribute , second attribute range attribute. example, forum thread table can have forumname , subject primary key, forumname hash attribute , subject range attribute. dynamodb builds unordered hash index on hash attribute , sorted range index on range attribute.

this means every row's primary key combination of hash , range key. can make direct gets on single rows if have both hash , range key, or can make query against sorted range index. example, get me rows table hash key x have range keys greater y, or other queries affect. have better performance , less capacity usage compared scans , queries against fields not indexed. their documentation:

query results sorted range key. if data type of range key number, results returned in numeric order; otherwise, results returned in order of ascii character code values. default, sort order ascending. reverse order, set scanindexforward parameter false

i missed things typed out , scratched surface. there a lot more aspects take consideration when working dynamodb tables (throughput, consistency, capacity, other indices, key distribution, etc.). should take @ sample tables , data page examples.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -