This commit is contained in:
iqudoo
2026-04-17 13:22:43 +08:00
parent 6423803562
commit ac8bd3c556

View File

@@ -264,8 +264,7 @@ public class ChangeLogContext {
```mysql ```mysql
DROP TABLE IF EXISTS `your_table_name`; DROP TABLE IF EXISTS `your_table_name`;
CREATE TABLE `your_table_name` CREATE TABLE `your_table_name` (
(
`guid` bigint(0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'GUID', `guid` bigint(0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'GUID',
-- ---------------------------- -- ----------------------------
-- add your table other table field -- add your table other table field
@@ -277,16 +276,35 @@ CREATE TABLE `your_table_name`
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '更新时间', `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`guid`) USING BTREE, PRIMARY KEY (`guid`) USING BTREE,
-- UNIQUE KEY `idx_unique_key` (`you unique key`,`delete_token`) USING BTREE, KEY `idx_common_query` (`is_hidden`, `is_delete`, `create_time` desc, `guid`) USING BTREE
) ENGINE = InnoDB COMMENT = '你的表格备注'
ROW_FORMAT = Dynamic;
```
### 索引优化指南
唯一键索引:
```
UNIQUE KEY `idx_unique_key` (`you unique key`,`delete_token`) USING BTREE,
-- KEY `idx_common_query` ( -- KEY `idx_common_query` (
-- 等值查询字段, -- 等值查询字段,
-- `is_hidden`,`is_delete`, -- `is_hidden`,`is_delete`,
-- 其他参与排序字段, -- 其他参与排序字段,
-- `create_time` desc, -- `create_time` desc,
-- `guid`) USING BTREE -- `guid`) USING BTREE
KEY `idx_common_query` (`is_hidden`, `is_delete`, `create_time` desc, `guid`) USING BTREE ```
) ENGINE = InnoDB COMMENT = '你的表格备注'
ROW_FORMAT = Dynamic; 查询索引:
```
KEY `idx_common_query` (
-- 等值查询字段,
`is_hidden`,`is_delete`,
-- 其他参与排序字段,
`create_time` desc,
`guid`
) USING BTREE
``` ```
**必需字段说明** **必需字段说明**