2009-09-29 120 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

三重确定你已经重建了你的痕迹,但它们并没有真正结转。