Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Mysql running very slow with high CPU usage and High load average, Please Help

Posted on 2014-02-10
4
Medium Priority
?
668 Views
Last Modified: 2014-02-18
Hi,


I have running a website with database mysql on RHEL 6 but mysql using 90-95% CPU and very high load average. It slow down with every connection for website. Please help    

here is my my.cnf

[mysqld]
datadir=/test
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

max_connections=500
max_allowed_packet=2G

wait_timeout=1500
long_query_time = 5
query_cache_size=536870912
query_cache_limit=8388608
max_allowed_packet=33554432
sort_buffer_size=16777216
read_buffer_size=16777216
read_rnd_buffer_size=33554432
key_buffer_size=134217728
myisam_sort_buffer_size=536870912
join_buffer_size=4194304
tmp_table_size=5343543296
max_heap_table_size=3196059648

#log-slow-queries = /var/log/mysql/mysql-slow.log
#long_query_time = 1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
 
EOF---------------------------------------------------------------------------------------------------------------

Here is the process list

mysql> show full processlist;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    89085
Current database: *** NONE ***

+-------+------+-----------------+----------+---------+------+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Id    | User | Host            | db       | Command | Time | State                | Info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
+-------+------+-----------------+----------+---------+------+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 89026 | remote | 10.59.7.7:45606 | remote_db | Execute |    7 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:24')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:24')>=0 andremlic.status_code = 'A'                        |
| 89030 | remote | 10.59.7.7:45607 | remote_db | Execute |   31 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  3383,2580,2986,11266) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:00')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:00')>=0 andremlic.status_code = 'A'      |
| 89033 | remote | 10.59.7.7:45608 | remote_db | Sleep   |    0 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89047 | remote | 10.59.7.6:50608 | remote_db | Execute |   10 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  3383,2580,2986,11266) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:21')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:21')>=0 andremlic.status_code = 'A'      |
| 89048 | remote | 10.59.7.6:50610 | remote_db | Execute |    1 | preparing            | SELECT site.site_id ,SIT_DISPLAY_NAME  ,SIT_LOGO_PATH, site.company, site.SIT_ACCOUNT_NUMBER ,site.country FROM site_accounts site where site.SIT_ACCOUNT_STATUS='ACTIVE' and site.DELETED_IND=0 and site.site_id in  (SELECT site_id from cdp_range    WHERE '2071287841' between low_address AND high_address AND upper(status)='APPROVED' AND DELETED_IND=0)                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 89049 | remote | 10.59.7.6:50633 | remote_db | Sleep   |    6 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89050 | remote | 10.59.7.6:50643 | remote_db | Sleep   |    2 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89051 | remote | 10.59.7.7:45610 | remote_db | Execute |   17 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  3383,2580,2986,11266) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:14')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:14')>=0 andremlic.status_code = 'A'      |
| 89052 | remote | 10.59.7.6:50647 | remote_db | Sleep   |    1 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89053 | remote | 10.59.7.7:45611 | remote_db | Execute |   17 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:14')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:14')>=0 andremlic.status_code = 'A'                        |
| 89054 | remote | 10.59.7.6:50648 | remote_db | Sleep   |   79 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89055 | remote | 10.59.7.7:45613 | remote_db | Execute |   35 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  722,2141,2731,11266) and DATEDIFF(remlic.startdate,'2014-02-10 06:02:56')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:02:56')>=0 andremlic.status_code = 'A'       |
| 89056 | remote | 10.59.7.6:50653 | remote_db | Execute |   23 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  3433,2580,2731,2986,11266) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:08')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:08')>=0 andremlic.status_code = 'A' |
| 89057 | remote | 10.59.7.6:50654 | remote_db | Execute |   24 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:07')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:07')>=0 andremlic.status_code = 'A'                        |
| 89058 | remote | 10.59.7.6:50655 | remote_db | Sleep   |    0 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89060 | remote | 10.59.7.6:50657 | remote_db | Execute |    5 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:26')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:26')>=0 andremlic.status_code = 'A'                        |
| 89061 | remote | 10.59.7.6:50659 | remote_db | Execute |   36 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:02:55')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:02:55')>=0 andremlic.status_code = 'A'                        |
| 89062 | remote | 10.59.7.7:45614 | remote_db | Sleep   |    0 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89065 | remote | 10.59.7.7:45616 | remote_db | Execute |   30 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:01')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:01')>=0 andremlic.status_code = 'A'                        |
| 89066 | remote | 10.59.7.6:50676 | remote_db | Execute |   21 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:10')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:10')>=0 andremlic.status_code = 'A'                        |
| 89070 | remote | 10.59.7.7:45617 | remote_db | Execute |   21 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:10')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:10')>=0 andremlic.status_code = 'A'                        |
| 89071 | remote | 10.59.7.7:45619 | remote_db | Execute |   54 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  14,1567) and DATEDIFF(remlic.startdate,'2014-02-10 06:02:37')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:02:37')>=0 andremlic.status_code = 'A'                   |
| 89072 | remote | 10.59.7.7:45620 | remote_db | Execute |   29 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:02')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:02')>=0 andremlic.status_code = 'A'                        |
| 89073 | remote | 10.59.7.7:45621 | remote_db | Execute |   17 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:14')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:14')>=0 andremlic.status_code = 'A'                        |
| 89074 | remote | 10.59.7.7:45622 | remote_db | Execute |   33 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:02:58')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:02:58')>=0 andremlic.status_code = 'A'                        |
| 89075 | remote | 10.59.7.7:45623 | remote_db | Execute |   13 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:18')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:18')>=0 andremlic.status_code = 'A'                        |
| 89080 | remote | 10.59.7.7:45625 | remote_db | Execute |   23 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:08')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:08')>=0 andremlic.status_code = 'A'                        |
| 89081 | remote | 10.59.7.7:45626 | remote_db | Execute |   14 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   and remlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:17')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:17')>=0 and remlic.status_code = 'A'                        |
| 89082 | remote | 10.59.7.7:45627 | remote_db | Sleep   |    4 |                      | NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 89083 | remote | 10.59.7.7:45628 | remote_db | Execute |   13 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc,  remlic.startdate, remlic.enddate, lic_types.name,CASE WHEN remlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHEN remlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p, remlic remlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND  remlic.PRODUCT_ID =p.product_id  and lic_types.id = remlic.type_id   and remlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:18')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:18')>=0 and remlic.status_code = 'A'                        |
| 89084 | remote | 10.59.7.7:45629 | remote_db | Execute |    1 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc, remlic.startdate,remlic.enddate, lic_types.name,CASE WHENremlic.cont_accessfrom IS NULL THEN '1900' ELSE SUBSTRING(remlic.cont_accessfrom,1,4) END AS contAccessFrom,CASE WHENremlic.cont_accessto IS NULL THEN '9999' ELSE SUBSTRING(remlic.cont_accessto,1,4) END AS contAccessTo, art.ART_COPYRIGHT_YEAR as cry from products p,remlicremlic, remlic_types lic_types, Article art where upper(p.PRODUCT_TYPE) = 'UNIT'   AND remlic.PRODUCT_ID =p.product_id  and lic_types.id =remlic.type_id   andremlic.site_id in (  13) and DATEDIFF(remlic.startdate,'2014-02-10 06:03:30')<=0 and DATEDIFF(remlic.expirey,'2014-02-10 06:03:30')>=0 andremlic.status_code = 'A'                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
+-------+------+-----------------+----------+---------+------+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
32 rows in set (0.03 sec)
0
Comment
Question by:aloknet21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:magarity
ID: 39848820
Are your tables indexed?
If so, how often do you have an ANALYZE TABLE issued to update the index statistics?
Can you get an explain plan for that query that shows up over and over in that output you provided?
0
 
LVL 1

Author Comment

by:aloknet21
ID: 39849547
Hi,

thanks for your reply. i have checked tables are indexed, but update statistics is not done from past 3 months.

Please suggest.

Thanks
0
 
LVL 13

Accepted Solution

by:
magarity earned 1500 total points
ID: 39850426
Three months is way too old. Use the analyze table command and set up a weekly or more often scheduled job to run it.
http://dev.mysql.com/doc/refman/5.0/en/analyze-table.html
Note that there is a table lock while this operation is performed; normally it is scheduled for when low activity is expected.  In your case, it sounds like an amergency so run it asap but then schedule it for slow times.
0
 
LVL 1

Author Comment

by:aloknet21
ID: 39852754
Hi,

We have updated the index now.

But when the load increases it is showing the same issue:

 603 | apps | 10.59.7.7:51677 | Reg_data | Sleep   |   18 |                      | NULL                                                                                                 |
| 616 | apps | 10.59.7.7:51798 | Reg_data | Sleep   |   18 |                      | NULL                                                                                                 |
| 617 | apps | 10.59.7.7:51801 | Reg_data | Sleep   |  112 |                      | NULL                                                                                                 |
| 620 | apps | 10.59.7.7:51804 | Reg_data | Sleep   |  112 |                      | NULL                                                                                                 |
| 621 | apps | 10.59.7.7:51806 | Reg_data | Sleep   |   18 |                      | NULL                                                                                                 |
| 622 | apps | 10.59.7.7:51807 | Reg_data | Sleep   |   18 |                      | NULL                                                                                                 |
| 623 | apps | 10.59.7.7:51808 | Reg_data | Sleep   |   18 |                      | NULL                                                                                                 |
| 624 | apps | 10.31.1.7:59201 | Reg_data | Sleep   |   10 |                      | NULL                                                                                                 |
| 625 | apps | 10.31.1.7:59202 | Reg_data | Execute |    7 | Copying to tmp table | select distinct p.product_id, p.product_code, p.product_desc,  licenses.startdate, licenses.enddate, |
| 630 | root | localhost       | NULL     | Query   |    0 | NULL                 | show processlist                                                                                     |
| 632 | apps | 10.31.1.7:59214 | Reg_data | Sleep   |    1 |                      | NULL                                                                                                 |
| 633 | apps | 10.31.1.7:59215 | Reg_data | Sleep   |    0 |                      | NULL                                                                                                 |
| 634 | apps | 10.31.1.7:59216 | Reg_data | Sleep   |    1 |                      | NULL                                                                                                 |
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question