关于"Specified key was too long; max key length is xxx bytes"

场景

给MySql数据库表Varchar类型字段加索引时报错:“Specified key was too long; max key length is xxx bytes”;

原因

字段太长导致无法加索引;

解决

修改字段长度,注意编码格式,例如你的字段长度为100(指的是字符数),而编码是utf-8,那么最大占用3乘100=300 byte,如果编码是utf8mb4则最大占用4乘100=400 byte。所以修改字段长度时要根据报错提示的长度以及你字段的长度和编码来修改;

### Linux `free -h` Command Usage and Explanation The `free` command provides a snapshot of the system's memory usage, including both RAM and swap space. When using `-h`, it displays all values in human-readable format (Kilobytes, Megabytes, Gigabytes). #### Syntax To use this command with human-readable output: ```bash free -h ``` This will display information about total, used, and available memory along with buffers/cache details. #### Output Columns Explained - **total**: Total installed physical or swap memory. - **used**: Memory currently being utilized by active processes. - **free**: Unused memory that is completely free to allocate immediately without needing any page eviction or swapping activity. - **shared**: Memory used by tmpfs (since version 3.18). - **buff/cache**: Sum of buffers and cache which can be quickly reclaimed when more memory is needed. - **available**: Estimation of how much memory is available for starting new applications without swapping out others; calculated from MemFree, Buffers, Cached, SReclaimable etc[^1]. For instance, running `free -h` might produce an output similar to below: ```plaintext total used free shared buff/cache available Mem: 7.7G 2.0G 4.9G 156M 804M 5.2G Swap: 2.0G 0B 2.0G ``` In this example, there are approximately 7.7 gigabytes of total RAM on the machine where around 2 gigabytes have been allocated while nearly 5 gigabytes remain unused but may still contain cached data ready for rapid reuse. --related questions-- 1. What does each column represent in the output of the `free -h` command? 2. How do buffer caches affect the reported amount of usable memory according to `free -h`'s results? 3. Can you explain what happens if my application requires more memory than shown under 'available'? 4. Is it normal for swap usage to increase even though plenty of RAM appears unallocated based on `free -h`? 5. Why would someone prefer checking memory status via `top` over simply using `free -h`?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值