### **訂單創建時名字跟檔案名字不匹配的核對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`