mysql notes

空 vs Null
1:空值(”)是不占用空间的
2: MySQL中的NULL其实是占用空间的。官方文档说明:
https://blog.csdn.net/qq_29180565/article/details/90050510

索引使用
https://blog.csdn.net/Sunnyside_/article/details/116008281

字符集
utf8 vs utf8mb4

唯一索引:
https://stackoverflow.com/questions/9764120/does-a-unique-constraint-automatically-create-an-index-on-the-fields

left join
https://www.jianshu.com/p/a0c0a1ab49bf

dynamodb analyst (3)- limits on development on dynamodb

除官网说的很清楚的哪些限制外,开发过程中,还会遇到如下一些限制:

1 BatchGetItem的时候最多一次获取100个:

https://docs.aws.amazon.com/zh_cn/amazondynamodb/latest/APIReference/API_BatchGetItem.html

With a single BatchGetItem request the maximum number of items to get is 100, as documented by AWS:
A single operation can retrieve up to 16 MB of data, which can contain as many as 100 items.

BatchGetItem
单个构建BatchGetItem操作最多可检索 100 个项目。检索到的所有项目总大小不能超过 16 MB。

BatchWriteItem
单个构建BatchWriteItem操作最多可以包含 25 个PutItem或者DeleteItem请求. 写入的所有项目总大小不能超过 16 MB。

“If you request more than 100 items, BatchGetItem returns a ValidationException with the message “Too many items requested for the BatchGetItem call.”

所以代码都是写死的:
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#batchLoad(java.lang.Iterable, com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig)

for ( Object keyObject : itemsToGet ) {
Class clazz = (Class)keyObject.getClass();
final DynamoDBMapperTableModel model = getTableModel(clazz, config);

String tableName = getTableName(clazz, keyObject, config);
classesByTableName.put(tableName, clazz);

if ( !requestItems.containsKey(tableName) ) {
requestItems.put(
tableName,
new KeysAndAttributes().withConsistentRead(consistentReads).withKeys(
new LinkedList>()));
}

requestItems.get(tableName).getKeys().add(model.convertKey(keyObject));

// Reach the maximum number which can be handled in a single batchGet
if ( ++count == 100 ) {
processBatchGetRequest(classesByTableName, requestItems, resultSet, config);
requestItems.clear();
count = 0;
}
}

2 本地索引(local secondary index.)创建必须在创建表时,不能像全局索引(global secondary index)那样可以创建表后创建。另外本地索引还有一个限制。单个hashkey的所有内容不能超过10G

3 从一个带有PK和SK的表中删除一批数据,必须带上PK + SK一起,仅仅PK是不行的。

4 当请求批量数据内容大于1M时,会被强制分页。参考下面的描述

Query
来自Query每次调用限制为 1 MB。您可以使用查询响应中的 LastEvaluatedKey 检索更多结果。
Scan
来自Scan每次调用限制为 1 MB。您可以使用扫描响应中的 LastEvaluatedKey 检索更多结果。

5 关于Binary类型

使用二进制属性的应用程序必须先用 Base64 格式对数据进行编码,然后将其发送至 DynamoDB。收到数据后,DynamoDB 会将数据解码为无符号字节数组,将其用作属性的长度。

6 只有BatchWriteItem,没有BatchUpdata,这点要注意。