This commit is contained in:
2025-09-07 13:09:10 +00:00
parent b93c35052d
commit 9221b39213
41 changed files with 287 additions and 4 deletions

View File

@@ -18,5 +18,8 @@
"quickfix.biome": "always",
"source.organizeImports.biome": "always"
},
"frontMatter.dashboard.openOnStart": false
"frontMatter.dashboard.openOnStart": false,
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/api/i/cache/20250812.jpg vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,59 @@
---
title: MySQL-VARCHAR支持的最大长度
published: 2025-09-07
description: ''
image: ''
tags: ['MySQL', 'VARCHAR']
category: '中间件 > MySQL'
draft: false
lang: ''
---
MySQL中最大行长度限制为65535字节如果一行中仅仅有一个varchar字段它的最大长度是多少呢
InnoDB/MyISAM 中一行最大长度限制是 65535 字节65 KB 左右)。)
长度> 255,存储varchar长度需要2字节长度<255存储varchar长度需要1字节。
所以
- 当长度>255且非空的时候可以存储65535 - 2 = 65533 字节。
- 当长度>255且可以为空的时候可以存储65535 - 2 - 1存储NULL标志 = 65532字节。
- 当长度<255且非空的时候可以存储65535 - 1 = 65534 字节。
- 当长度<255且可以为空的时候可以存储65535 - 1 - 1存储NULL标志 = 65533字节。
如果只有一个 VARCHAR 字段
假设表里只有这一列:
```sql
CREATE TABLE t (
v VARCHAR(N)
) ENGINE=InnoDB;
```
行最大长度65535 字节。
除了数据外,还有:
NULL 标志位(至少 1 字节,即使只有一列)。
VARCHAR 长度字节1 或 2
所以最大能用来存储 v 的 = 65535 - 1 (NULL 标志) - 2 (长度字节) = 65532 字节。
因此:
✅ 单列 VARCHAR 最大可定义为 VARCHAR(65532)
> 如果是非null就不需要占用那一字节null标志位了
```sql
CREATE TABLE t (
v VARCHAR(N) NOT NULL
) ENGINE=InnoDB;
```
这里N就可以是65533了
![](https://blog.meowrain.cn/api/i/2025/09/07/xz52lm-1.webp)
![](https://blog.meowrain.cn/api/i/2025/09/07/xy0628-1.webp)

View File

@@ -0,0 +1,21 @@
---
title: MySQL中CHAR和VARCHAR的区别
published: 2025-09-07
description: ''
image: ''
tags: ['MySQL', 'CHAR', 'VARCHAR']
category: '中间件 > MySQL'
draft: false
lang: ''
---
![](https://blog.meowrain.cn/api/i/2025/09/07/xy0628-1.webp)
# CHAR(n)
char(n) 是固定长度的字符串CHAR列的长度是固定的即使存储的字符串长度小于定义的长度MySQL也会在字符串的末尾填充空格以达到指定的长度。
# VARCHAR(n)
可变长度的字符串varchar列的长度是可变的存储的字符串长度与实际数据长度相等并且在存储数据的时候会额外增加1到2个字节字符串长度超过255就用两个字节 用于存储字符串的长度信息。
理论上char比varchar会快因为varchar长度不固定处理需要多一次运算但是实际上这种运算耗时微乎其微而固定大小在很多场景下比较浪费空间除非存储的字符确认是固定大小或者本身就很短不然业务上推荐使用varchar.

View File

@@ -0,0 +1,30 @@
---
title: MySQL事务隔离级别
published: 2025-09-07
description: ""
image: ""
tags: ["事务隔离级别", "MySQL"]
category: "中间件 > MySQL"
draft: false
lang: ""
---
![](https://blog.meowrain.cn/api/i/2025/09/07/yscnoh-1.webp)
# 1 读未提交(脏读,不可重复读,幻读 问题)
最低的事务隔离级别,在这个事务隔离级别下,一个事务能看到另外一个事务未提交的数据修改,会导致 **脏读** 的问题(读取到其他事务未提交的数据)
# 2 读已提交(不可重复读,幻读)
这个事务隔离级别虽然解决了脏读问题,也就是只能读取到另外一个事务已经提交的数据,读取不到另外一个事务没有提交的数据,但是它有**不可重复读**的问题(同一个事务中,相同的查询会返回不同的结果)
# 3 可重复读(幻读) MySQL 默认事务隔离级别
这个事务隔离级别,使用 MVCC快照读的方式解决了不可重复读的问题但是还是有**幻读**的问题(幻读也就是在一个事务中,读取到另外一个事务插入的行,导致这个事务查询到的结果集行数不同)
![](https://blog.meowrain.cn/api/i/2025/09/07/yu38tz-1.webp)
# 4 串行化
最高的事务隔离级别使用排他锁Exclusive Lock来保证事务的完全隔离。

View File

@@ -0,0 +1,44 @@
---
title: MySQL索引类型有哪些
published: 2025-08-14
description: ''
image: ''
tags: [索引, MySQL]
category: '中间件 > MySQL'
draft: false
lang: ''
---
# MySQL索引类型有哪些
## 按数据结构分
分为
- B-Tree索引
- Hash索引
- Full-text索引
![](https://blog.meowrain.cn/api/i/2025/08/15/5dxy1-1.webp)
创建表的时候InnoDB存储引擎会根据不同的场景选择不同的列作为索引
- 有主键:会使用主键作为聚簇索引的索引键
- 没有主键: 选择第一个不包含NULL值的唯一列作为聚簇索引的索引键
- 上面两个都没有的情况下InnoDB会自动生成一个隐式自增id列作为聚簇索引的索引键。
其他索引都属于辅助索引,也就是非聚簇索引或者二级索引。
## 按物理存储分
分为
- 聚簇索引(主键索引)
- 二级索引(辅助索引)
## 按字段特性分
- 主键索引
- 唯一索引
- 普通索引
- 前缀索引
主键索引是唯一的且不允许为NULL。每个表只能有一个主键索引。
## 按字段个数分
- 单列索引
- 联合索引

View File

@@ -0,0 +1,23 @@
---
title: flowable学习
published: 2025-08-12
description: ''
image: ''
tags: [Flowable,流程引擎,工作流]
category: '工作'
draft: false
lang: ''
---
![](https://blog.meowrain.cn/api/i/2025/08/12/h1jv9s-1.webp)
发布流程后,会在下面几张表里有记录
![](https://blog.meowrain.cn/api/i/2025/08/12/h9knpj-1.webp)
![](https://blog.meowrain.cn/api/i/2025/08/12/h9qh26-1.webp)
![](https://blog.meowrain.cn/api/i/2025/08/12/h9ujzp-1.webp)
![](https://blog.meowrain.cn/api/i/2025/08/13/xu7b2n-1.webp)

View File

@@ -0,0 +1,103 @@
---
title: 动态规划解题思路
published: 2025-08-17
description: ''
image: ''
tags: [动态规划,数据结构与算法]
category: '数据结构与算法'
draft: false
lang: ''
---
# 动态规划解题思路
## 斐波那契数列
暴力递归
```java
// f(n) 计算第 n 个斐波那契数
static int fib(int n) {
if(n <= 1 && n >= 0) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
```
使用Memo数组存储避免重复计算
```java
static long fib2(int n) {
long[] memo = new long[n + 1];
Arrays.fill(memo,-1);
return dp(memo,n);
}
static long dp(long[] memo,int n) {
if(n == 0 || n == 1) {
return n;
}
if(memo[n] != -1) {
return memo[n];
}
memo[n] = dp(memo,n - 1) + dp(memo,n - 2);
return memo[n];
}
```
## 零钱兑换
![](https://blog.meowrain.cn/api/i/2025/08/17/julgjy-1.webp)
```java
class Solution {
public int coinChange(int[] coins, int amount) {
int[] dp = new int[amount + 1];
Arrays.fill(dp,amount + 1);
dp[0] = 0;
for(int i = 0;i<dp.length;i++) {
for(int coin : coins) {
if(i - coin < 0) {
continue;
}
dp[i] = Math.min(dp[i],1 + dp[i - coin]);
}
}
return (dp[amount] == amount + 1) ? -1 : dp[amount];
}
}
```
```java
class Solution {
int[] memo;
public int coinChange(int[] coins, int amount) {
memo = new int[amount + 1];
// 备忘录初始化为一个不会被取到的特殊值,代表还未被计算
Arrays.fill(memo, -666);
return dp(coins, amount);
}
int dp(int[] coins, int amount) {
if (amount == 0) return 0;
if (amount < 0) return -1;
// 查备忘录,防止重复计算
if (memo[amount] != -666)
return memo[amount];
int res = Integer.MAX_VALUE;
for (int coin : coins) {
// 计算子问题的结果
int subProblem = dp(coins, amount - coin);
// 子问题无解则跳过
if (subProblem == -1) continue;
// 在子问题中选择最优解,然后加一
res = Math.min(res, subProblem + 1);
}
// 把计算结果存入备忘录
memo[amount] = (res == Integer.MAX_VALUE) ? -1 : res;
return memo[amount];
}
}
```