Solved

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

Posted on 2014-02-10
4
659 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
  • 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 500 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

839 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