The first lecture of the Dynamodb series

dynamodb is an aws NOSQL fully managed database.
1. All tables are partitioned, and there are two primary keys:
   a "set only one partition key
   b" set a partition key and a range key, which is equivalent to a joint primary key

2. It can be automatically performed according to the amount of data in the table and capacity unit Partition expansion
   a" Each partition has a maximum of 10GB. If the data volume of the table exceeds 10GB, two partitions will be created automatically, the data will be evenly distributed into the two newly created partitions, and then the original partition will be deleted, that is, the original partition will be deleted. Become two new partitions
   b" A partition supports a maximum of 3000 read capacity units and 1000 write capacity units. If the capacity unit changes, it may lead to an increase in the number of partitions. For example,
        the original capacity is read 1000 write 500 1000 /3000+500/1000=0.888 The new capacity of 1 partition
        is read 1000 write 1000 1000/3000+1000/1000=1.333 2 partitions

3.No schema, you only need to specify the primary key when creating a table, and other fields are inserted into the table. When dynamically specified, each record can have a different number of fields, and the fields with the same name in different records can also have different

types. 4. Multiple field types support the storage of json data
Scalar type, which is a single value type
    String abcd
    Number 24.56
    Boolean true, false
    Binary binary data, such as image
    Null is unknown or undefined
Document type
    Map json format
    List list, the list can store different types of item
    Set Collection The types of items stored in the collection must be consistent, such as String, or Number

5. TTL is supported. If you want the records in the table to exist only for a period of time and automatically delete after expiration, you can specify a ttl field, so that dynamodb will automatically help you delete expired data according to the value of the retention period, such as two hours. One week, two years, any period of time

6. The operation of the table supports stream, that is, the stream. By opening the stream, the addition, deletion and modification of the table can be recorded in the stream pipeline, and then we can trigger the lambda function through the trigger to consume the data in the stream. If stream is enabled, there are three types to choose from:
a "only new image" only output the modified record, such as insert
b" only old image, only output the record before modification, such as delete
c" new image and old image, output before and after the change, such as update

7. Support global secondary index and local secondary index, that is, GSI and LSI
GSI supports cross-partition retrieval
LSI only supports retrieval within the same partition

8. Does not support foreign key associations, nor table joins, supports begin_with, contains Equal conditional expression

9. Retrieval includes query and scan
query to retrieve by primary key or index, which is faster
Scan can be retrieved through any field, because it does not use indexes and partitions, the speed is slow, and the whole table query

10. Support batch retrieval and batch insertion and deletion
BatchGetItem can return a maximum of 100 records
each time BatchWriteItem can write or delete a maximum of each time 25 records

11. Charge by the hour for capacity unit, such as write capacity unit 10unit an hour 0.00742USD, read capacity unit 50unit an hour 0.00742USD

12. Retrieval is divided into final consistency and strong consistency, the default is
strong final consistency For integration, 1 read capacity unit, records within 4K, can read 1
eventual consistency in 1 second,

1 write capacity unit can read 2 records in 1 second, and records within 1K can write 1 record in 1 second , if the record occupies 2K, and the same is written in 1 second, 2 write capacity units are required

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326280632&siteId=291194637