Welcome Guest, Not a member yet? Register   Sign In
session lock problem
#11

@makif,

If queries are taking a long time then we need to look at whether or not the used tables need indexes. What queries are taking a long time to execute? Can you run an Explain on them?
Reply
#12

(This post was last modified: 02-17-2019, 11:56 PM by makif.)

(02-11-2019, 01:44 PM)php_rocs Wrote: @makif,

If queries are taking a long time then we need to look at whether or not the used tables need indexes.  What queries are taking a long time to execute? Can you run an Explain on them?

for example count queries takes long time, query has joins and where and it locked all sessions.
and i check explaion other queries
Reply
#13

@makif,

Can you show us examples of the queries that are running long? What tables are being used in the queries? What information did the explain give you on the queries?
Reply
#14

(02-18-2019, 12:08 AM)php_rocs Wrote: @makif,

Can you show us examples of the queries that are running long?  What tables are being used in the queries?  What information did the explain give you on the queries?

t1 table has 22 millions rows
Code:
EXPLAIN
SELECT COUNT(1) AS total
FROM t1 p FORCE INDEX (PRIMARY)
INNER JOIN t2 e ON p.c2= e.c1
WHERE `e`.`Type` IN ("PARKINGLOT","PARKINGVIOLATION","REDLIGHTVIOLATION","FORBIDDENTURN","ALPR","EMBEDDEDALPR","SECTIONSPEED","SENSOR_REDLIGHT","SENSOR_SPEED")
explanation show me, p not use key
Reply
#15

@makif,

Does the t1 table have indexes? if so, what are they?
Reply
#16

(02-18-2019, 08:40 AM)php_rocs Wrote: @makif,

Does the t1 table have indexes?  if so, what are they?

yes t1 has many indexes. especially prımary, also unique index, t1 has indexes which can searchable
Reply
#17

@makif,

What about t2?

When you ran the explain feature what was the output?
Reply
#18

(02-19-2019, 12:40 AM)php_rocs Wrote: @makif,

What about t2?

When you ran the explain feature what was the output?

t2 show me its key area is  PRIMARY, but t2 has just max 100-200 rows, and also  t2 has the keys for searchable
Reply
#19

@makif,

How long does it take for the query to run?
Reply
#20

(02-19-2019, 01:19 AM)php_rocs Wrote: @makif,

How long does it take for the query to run?

it takes more than a minute and it locked all session again.
does it suppose to lock just session which send request?  or am i wrong
Reply




Theme © iAndrew 2016 - Forum software by © MyBB