2009-09-29 119 views
0

我已經將我的drupal站點從一臺mysql服務器移至另一臺。舊機器有1個CPU,1GB內存 新機器有4個CPU,4GB內存。MySQL性能查詢

我對性能比較此查詢(2分鐘對2秒)

select distinct c.client 
    from client_table c 
    LEFT JOIN reps r on (c.client = r.client) 
    where r.user_id is NULL 
    AND c.client not in (select distinct client from billing where first_purchase = 1) 


NEW       OLD 
| connect_timeout   10     |connect_timeout   5 
| have_federated_engine  DISABLED    | have_federated_engine  YES 
| max_connections   100     | max_connections   400 
| max_seeks_for_key   18446744073709551615 | max_seeks_for_key   4294967295 
| max_write_lock_count  18446744073709551615 | max_write_lock_count  4294967295 
| myisam_max_sort_file_size 9223372036853727232 | myisam_max_sort_file_size 2147483647 
| max_binlog_cache_size  18446744073709547520 | max_binlog_cache_size  4294967295 
| myisam_recover_options BACKUP    | myisam_recover_options  OFF 
| range_alloc_block_size 4096     | range_alloc_block_size  2048 
| table_cache    457     | table_cache    307 
| version     5.0.67-0ubuntu6-log | version     5.0.51a-3ubuntu5.4-log 
| version_compile_machine x86_64    | version_compile_machine i486 


ONLY on NEW | relay_log      | 
ONLY on NEW | relay_log_index     |    
ONLY on NEW | relay_log_info_file    | relay-log.info 
ONLY on NEW innodb_adaptive_hash_index  | ON 

如何確定是什麼原因造成的問題或如何解決它的任何想法巨大的負面區別?

+2

你比較瞭解釋嗎? – 2009-09-29 17:20:39

+0

我可以試試。儘管它可能會導致我的網站停止。 – 2009-09-29 17:25:13

回答

0

嘗試使用MySQL Query Profiler

我會在兩種環境中進行配置文件。

那麼你如何去分析 數據庫的性能?有三種形式 被 用於診斷和調整數據庫 系統的性能分析:

瓶頸分析 - 側重於 回答的問題:什麼是我的 數據庫服務器等待;什麼是 用戶連接在等待;什麼是 一段SQL代碼在等待?

工作量分析 - 檢查服務器和誰登錄以確定資源 各自的使用情況和活動​​。

基於比率的分析 - 利用 數目原則進行的拇指比率到一個數據庫的 計性能,用戶 連接,或一段代碼。

2

三重確定你已經重建了你的痕跡,但它們並沒有真正結轉。