### **订单创建时名字跟档案名字不匹配的核对sql**
```
select a.order_code as '订单号',
SUBSTRING_INDEX(SUBSTRING_INDEX(a.order_name,'_',2),'_',-1) as '订单创建时用户名',
b.cust_name as '用户名',
a.created as '创建时间',
a.order_register_date '登记时间'
from biz_order a,arch_customer b
where a.status = 0 and a.delete_flag = 0
and b.status = 0 and b.delete_flag = 0
and a.cust_id = b.id
and SUBSTRING_INDEX(SUBSTRING_INDEX(a.order_name,'_',2),'_',-1) != b.cust_name
and pinyin(SUBSTRING_INDEX(SUBSTRING_INDEX(a.order_name,'_',2),'_',-1) ) != pinyin(b.cust_name)
and a.created >= '2020-08-01';
```
### **核对订单项目跟档案的性别不一致的**
```
select a.order_code as '订单号',
SUBSTRING_INDEX(SUBSTRING_INDEX(a.order_name,'_',2),'_',-1) as '订单创建时用户名',
c.union_code as '订单组合代码',
c.union_name as '订单组合名称',
d.union_code as '字典组合代码',
d.union_name as '字典组合名称',
if(d.union_gender_rel =1,'男',if(union_gender_rel = 2,'女','无关')) as '组合性别',
b.cust_name as '用户名',
e.item_name as '用户性别',
a.created as '创建时间',
a.order_register_date '登记时间'
from (biz_order a,arch_customer b,biz_order_package_union c,dict_union d)
left outer join com_classify_item e on b.cust_sex_id = e.id
where a.status = 0 and a.delete_flag = 0
and b.status = 0 and b.delete_flag = 0
and c.status = 0 and c.delete_flag = 0 and c.order_union_option in (0,1)
and d.status = 0 and d.delete_flag = 0
and a.cust_id = b.id
and a.id = c.order_id
and c.union_id = d.id
and d.union_gender_rel != b.cust_sex_code
and d.union_gender_rel != 0
and a.created >= '2020-08-01'
```
### **数据库最大行数**
```
select table_schema,table_name,table_type,table_rows from information_schema.tables order by table_rows desc limit 10;
```
### **数据库数据量大小 **
```
select concat(round(sum(DATA_LENGTH/1024/1024/1024),2),'GB') as data from information_schema.TABLES;
show status like '%connect%';
show variables like '%max\_connections%';
```
### **数据库连接数**
```
show status like 'Threads%';
```
### **数据库最大连接数**
```
show variables like '%max_connections%';
```
### **系统性能**
top 查看cpu/内存 按e切换内存单位
### **查看磁盘**
`df -mh`
### **查看内存**
`free -h`
### **redis内存占用**
```
redis-cli
> info Memory
> used_memory:xxxx
> info clients
> CONFIG GET maxclients
> dbsize
```
used_memory:xxxx
### **查看开启启动项** enabled 为已建立启动连接的
`systemctl list-unit-files |grep http/redis/mysql`
