[size=large]切換到同一臺物理機測試
1.物理機的情況:
記憶體:16g
cpu:4核 cpu mhz : 800.000
2.建同樣的庫表
3.造資料5000w測試[/size]
[table]
||sql||數量||mysql||infobright
||在伺服器上全表count||5000w||25.08s||0.08s
||python執行:d_o_lastordertime>='2012-06-19' and s_usr_level>60 and i_u_verified=1 ||0||36s||<1s
||count:i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||1254437||29s;29s;29s||4s;4s;4s
||fetch_data(分頁5w):i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||50w||77s;76;75s||42s;37s;41s
[/table]
[size=large]4.刪除重造資料10000w[/size]
[table]
||sql||數量||mysql||infobright
||在伺服器上全表count||10000w||3m34.08s||0.06s
||python執行:d_o_lastordertime>='2012-06-19' and s_usr_level>60 and i_u_verified=1 ||0||36s||<1s
||count:i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||2506968||2m55s;2m40s;2m30s||9s;9s;8s
||fetch_data(分頁5w):i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||50w||1m40s;1m41s;1m42s||1m22s;1m21s;1m22s
||fetch_data(分頁5w):i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||100w||7m22s;5m22s;1m42s||2m49s;2m49s;2m47s
||count:i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 and f_o_total_spend_3m<200 and f_o_kdj_3m>300 and i_o_sendnumber_3m<10||49128||205s;371s;258s||29s;70s;65s
||fetch_data(分頁5w):i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||49128||285s;222s;187s||451s;449s;485s
||fetch_data(分頁4個執行緒5w):i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||50w||47s;40s;42s||25s;27s;25s
||fetch_data(分頁4個執行緒5w):i_u_***=1 and s_o_usermob_type=2 and i_o_ordesnum_3m=4 and i_u_verified=1 ||100w||108s;106s;107s||44s;44s;49s
||count_like(前置like查詢):s_u_unicknme like '%test1' ||1||330s;340s;330s||45s;44s;45s
||count_like(後置like查詢):s_u_unicknme like 'test%' ||10000w||108s;106s;107s||0.16s;0.01s;0.01s
||count_like(中文後置like查詢):s_u_unicknme like '中午test測試%' ||10000w||174s;170s;172s||0.16s;0.01s;0.01s
[/table]
[size=large]注:mysql分頁取資料,每次的時候是遞增的,infobright的時間每次相差1s擺動,資料剛載入完馬上查取時,時間稍微長一點,過後測試沒發現問題
1.設定統一編碼utf8
show variables like "%char%";
show variables like 'collation_%';
set names 'utf8';
2.load另外張表的資料時,不影響其它表的查詢
[/size]
Mysql 一般注入
一 基礎知識 1.注釋符 hash comment c style comment sql comment 後必須跟空格 00 nullbyte backtick 使用在查詢最後 2.空格被過濾 使用 或 或 代替空格 0c form feed,new page 09 horizontal tab ...
MySql優化的一般步驟
mysql優化的一般步驟 1.通過show status 命令了解各種sql的執行效率 2.定位執行效率較低的sql語句 dql出現問題的概率較dml的大 mysql支援把慢查詢語句記錄到日誌檔案中。3.通過explain分析低效率的sql語句的執 況 4.常用的優化措施是新增索引。新增索引,我們不...
MySql的一般命令淺述
1 查詢當前正在使用的資料庫 select database 2 mysql使用步驟 show databases 顯示有哪些資料庫 use xx 使用某乙個資料庫 create table yy id int not null,name varchar 20 not null,age int nu...