为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:
【概述】 需求是使用load data导入csv数据到分区表中
【备份和数据迁移策略逻辑】
【背景】
【现象】 业务和数据库现象
【问题】 先使用load data命令导入数据,数据导入成功,通过sql查询表的数据量,显示正常.
查看各个分区数据量,发现都是0
后来通过别的表insert过来一条数据,
![image](https://asktug.com/uploads/default/original/3X/5/0/500b5b87d06d4e0452e929e7b4dd0992adb58727.png)
在查看分区表,分区表里有数据了
请问这是什么原因,是load data的时候无法支持分区表吗?
另外:app_commons和app_commons2中的数据一模一样,表结构除了app_commons有分区,app_commons2上没分区外,其余都一样,分区字段是datatime字段,分区方式如下:
PARTITION BY RANGE ( TO_DAYS(dt_server_time) ) (
PARTITION p00000000 VALUES LESS THAN ( TO_DAYS(‘2020-01-26’) ),
PARTITION p20200126 VALUES LESS THAN ( TO_DAYS(‘2020-01-27’) ),
PARTITION p20200127 VALUES LESS THAN ( TO_DAYS(‘2020-01-28’) ),
PARTITION p20200128 VALUES LESS THAN ( TO_DAYS(‘2020-01-29’) ),
PARTITION p20200129 VALUES LESS THAN ( TO_DAYS(‘2020-01-30’) ),
PARTITION p20200130 VALUES LESS THAN ( TO_DAYS(‘2020-01-31’) ),
PARTITION p20200131 VALUES LESS THAN ( TO_DAYS(‘2020-02-01’) ),
PARTITION p20200201 VALUES LESS THAN ( TO_DAYS(‘2020-02-02’) ),
PARTITION p20200202 VALUES LESS THAN ( TO_DAYS(‘2020-02-03’) ),
PARTITION p20200203 VALUES LESS THAN ( TO_DAYS(‘2020-02-04’) ),
PARTITION p20200204 VALUES LESS THAN ( TO_DAYS(‘2020-02-05’) ),
PARTITION p20200205 VALUES LESS THAN ( TO_DAYS(‘2020-02-06’) ),
PARTITION p20200206 VALUES LESS THAN ( TO_DAYS(‘2020-02-07’) ),
PARTITION p20200207 VALUES LESS THAN ( TO_DAYS(‘2020-02-08’) ),
PARTITION p20200208 VALUES LESS THAN ( TO_DAYS(‘2020-02-09’) ),
PARTITION p20200209 VALUES LESS THAN ( TO_DAYS(‘2020-02-10’) ),
PARTITION p20200210 VALUES LESS THAN ( TO_DAYS(‘2020-02-11’) ),
PARTITION p20200211 VALUES LESS THAN ( TO_DAYS(‘2020-02-12’) ),
PARTITION p20200212 VALUES LESS THAN ( TO_DAYS(‘2020-02-13’) ),
PARTITION p20200213 VALUES LESS THAN ( TO_DAYS(‘2020-02-14’) ),
PARTITION p20200214 VALUES LESS THAN ( TO_DAYS(‘2020-02-15’) ),
PARTITION p20200215 VALUES LESS THAN ( TO_DAYS(‘2020-02-16’) ),
PARTITION p20200216 VALUES LESS THAN ( TO_DAYS(‘2020-02-17’) ),
PARTITION p20200217 VALUES LESS THAN ( TO_DAYS(‘2020-02-18’) ),
PARTITION p20200218 VALUES LESS THAN ( TO_DAYS(‘2020-02-19’) ),
PARTITION p20200219 VALUES LESS THAN ( TO_DAYS(‘2020-02-20’) ),
PARTITION p20200220 VALUES LESS THAN ( TO_DAYS(‘2020-02-21’) ),
PARTITION p20200221 VALUES LESS THAN ( TO_DAYS(‘2020-02-22’) ),
PARTITION p20200222 VALUES LESS THAN ( TO_DAYS(‘2020-02-23’) ),
PARTITION p20200223 VALUES LESS THAN ( TO_DAYS(‘2020-02-24’) ),
PARTITION p20200224 VALUES LESS THAN ( TO_DAYS(‘2020-02-25’) ),
PARTITION p20200225 VALUES LESS THAN ( TO_DAYS(‘2020-02-26’) ),
PARTITION p20200226 VALUES LESS THAN ( TO_DAYS(‘2020-02-27’) ),
PARTITION p99999999 VALUES LESS THAN (MAXVALUE)
)
【业务影响】
【TiDB 版本】 5.0.2
【附件】
- 相关日志、配置文件、Grafana 监控(https://metricstool.pingcap.com/)
- TiUP Cluster Display 信息
- TiUP CLuster Edit config 信息
- TiDB-Overview 监控
- 对应模块的 Grafana 监控(如有 BR、TiDB-binlog、TiCDC 等)
- 对应模块日志(包含问题前后 1 小时日志)
若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。