Locking issue in innodb select query
Hi Rick,
I am getting locking issue even in select queries with innodb engine. Please check below query which normally took 2 seconds but some time it is taking more than 40 seconds and also at this time locking time is also more than normal time. Please help me why this query is taking too much time and specially reason of locking time. As per my understanding there should not be any locking in select query in innodb engine. Please help
Details are here-
# Time: 130711 17:30:21
# User@Host: bitcrm[bitcrm] @ [10.1.32.183]
# Query_time: 40.599935 Lock_time: 0.001275 Rows_sent: 22 Rows_examined: 582273
SET timestamp=1373544021;
SELECT COUNT(smt.SMTNAME) AS countval, smt.SMTNAME AS statusname, SUM(psttab.PSTPAYABLEPRICE) AS priceval FROM ISMPST AS psttab JOIN ISMSMT AS smt ON psttab.PSTSMTSTATUS = smt.SMTRFNUM AND psttab.CREATEDATE >= '2013-04-11' AND (psttab.PSTISCOMBO = 'N' OR psttab.PSTISCOMBO IS NULL) GROUP BY smt.SMTNAME;
-----------------------------------
mysql> EXPLAIN SELECT COUNT(smt.SMTNAME) AS countval, smt.SMTNAME AS statusname, SUM(psttab.PSTPAYABLEPRICE) AS priceval FROM ISMPST AS psttab JOIN ISMSMT AS smt ON psttab.PSTSMTSTATUS = smt.SMTRFNUM AND psttab.CREATEDATE >= '2013-04-11' AND (psttab.PSTISCOMBO = 'N' OR psttab.PSTISCOMBO IS NULL) GROUP BY smt.SMTNAME\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: psttab
type: range
possible_keys: IDX_PSTSMTSTATUS,IDX_CREATEDATE,IDX_PSTISCOMBO
key: IDX_CREATEDATE
key_len: 5
ref: NULL
rows: 244250
Extra: Using where; Using temporary; Using filesort
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: smt
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 8
ref: bitshop.psttab.PSTSMTSTATUS
rows: 1
Extra:
2 rows in set (0.00 sec)
------------------------------------------------------------
SELECT COUNT(*) FROM PSST -- 3048426
SELECT COUNT(*) FROM SMMT -- 87
---------------------------
Thanks,
Zafar
Subject
Views
Written By
Posted
Locking issue in innodb select query
2228
July 11, 2013 06:30AM
987
July 12, 2013 09:42AM
1053
July 31, 2013 02:08AM
964
August 01, 2013 10:19PM
1334
August 02, 2013 04:04AM
1032
August 03, 2013 09:11AM
979
August 12, 2013 12:45AM
879
August 13, 2013 11:27PM
951
August 14, 2013 01:14AM
848
August 31, 2013 05:39PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.