正式環境問題分析指令碼

2021-10-10 03:20:28 字數 2768 閱讀 6626

-- 1、查詢某列是否別索引引用

show index from t_loca where column_name like 'status'

-- 2、查一張表有哪些索引 

show index from t_busi_task where key_name='status';

select count(id) from t_order;

-- 檢視表建立sql

show create table t_user;

-- 3、強制走某索引

select  * from ***_log force index(ocode_oorder_id_ocomp_id)

-- 檢視連線該庫的ip

show processlist;

-- show full  processlist;

select  *  from    information_schema.processlist order by command;

-- 查詢所有事務的資訊,當表被鎖或查詢緩慢時使用

select * from information_schema.innodb_trx order by trx_started;

select count(1) from information_schema.innodb_trx;

kill 83467634;

-- 查詢所有程序

show processlist;

-- 主要包含了innodb事務鎖的具體情況,包括事務正在申**的鎖和事務加上的鎖。

select * from information_schema.innodb_locks;

-- 包含了blocked的事務的鎖等待的狀態

select * from information_schema.innodb_lock_waits;

select count(1) from t_busi_seq_task_detail;

select count(1) from t_busi_seq_task;

select * from information_schema.innodb_trx order by trx_started;

-- 顯示你資料庫中存在碎片的全部列表

select table_schema db, table_name, data_free/1024/1024 freemb, data_free, engine,table_rows,data_length+index_length length 

from information_schema.tables   where table_schema not in ('information_schema', 'mysql') and data_free > 0  

order by data_free desc;

select table_schema db, sum(data_free/1024/1024/1024) free, engine,sum(data_length+index_length)/1024/1024/1024 total

, sum(data_length)/1024/1024/1024 datalenght, sum(index_length/1024/1024/1024) indexlenght  

from information_schema.tables   where table_schema not in ('information_schema', 'mysql')  group by table_schema

select table_schema db, table_name, data_free, engine,table_rows,data_length+index_length length from information_schema.tables 

where table_schema not in ('information_schema', 'mysql') and table_name in ('t_order_detail','t_order_extend','t_order')

order by data_free desc;

select * from t_order where rea

-- optimize table t_busi_seq_task_detail;

select count(1) from information_schema.tables 

where table_schema not in ('information_schema', 'mysql') and data_free > 0;

-- 查詢碎片大於100m的表

select table_schema, table_name, data_free/1024/1024 as data_free_mb from information_schema.tables where engine like 'innodb' and data_free > 10*1024*1024; 

-- 查詢所有表資料占用記憶體總和

select concat(round(sum(data_length/1024/1024),2),'mb') as data from information_schema.tables where table_schema='wllinked_standard';

select concat(round(sum(data_length),2),'byte') as data 

from information_schema.tables where table_schema='wllinked_standard';

MongoDB備份指令碼 正式環境

root mongodb more opt script mongodb data.sh bin bash author lumia98 vip.qq.com 備份mongodb 4.0.2 mongodb備份指令碼 linux環境 centos redhat mongodump執行 dump mo...

正式環境與生產環境隔離方案

正式環境和測試環境隔離可採用 阿里雲安全組隔離 注意事項 1 辦公網訪問正式環境需要走 或者vpn通道 目前有訪問正式環境許可權的人,就有訪問正式環境mongodb的許可權 因此目前需要控制可以訪問生產環境的人員限制 最終解決方法就是以後給mongodb加上使用者許可權驗證,等以後內網的測試環境搭建...

測試環境與正式環境webpack打包路徑問題

預設的webpack打包命令只有乙個npm run build,所以就產生乙個問題,測試環境部署跟正式環境分不開,靜態資源路徑無法動態賦值,下面是一套簡單的解決方案 我們在build資料夾下新建build test.js檔案,copy build.js檔案裡面的內容 並加入一句 process.en...