Home > database >  Mysql query extremely slow and lock table
Mysql query extremely slow and lock table

Time:10-07

SELECT a. * FROM (SELECT DISTINCT b.i d event_id, a.c ontrol_id, a.c ontrol_item_id, b.e venttime event_time, b.e ventinfo event_info, 'event_type_id,' create_time, a.c ontrol_number event_number, ' 'the SUBJECT, "object,"' occurrence FROM control_item_info a INNER JOIN control_event_info_new b ON a.c ontrol_number=b.s FZH INNER JOIN zdsj_yjsj_sourcecode c ON b.s ource c.s. ource)=a
INNER JOIN control_base_info b ON a.c ontrol_id=biggest ontrol_id AND b.a pplicant_id='014591' AND (biggest ontrol_model_id=1 OR b.a pplicant_id='014591')

When data only 300 control_event_info_new table I perform the SQL particularly fast, but the data reaches tens of thousands of article is particularly slow, nearly 5 min? SQL is also have to have a problem?

CodePudding user response:

Will need to calculate the field tag try the primary key

CodePudding user response:

Can't you? Associated fields are repeatable

CodePudding user response:

You try to say again first

CodePudding user response:

The building Lord, her meaning is indexed

CodePudding user response:

Select count (*) FROM control_item_info AS a
INNER JOIN
Control_event_info_new AS b
ON a.c ontrol_number=b.s FZH
INNER JOIN
Zdsj_yjsj_sourcecode AS c
ON b.s ource c.s. ource=

Look, if the number of records a lot of that is recorded quantity lead to performance problems, according to the information you provide, the estimate is high repetition rate leads to
If the few records, but slowly, so may be not appropriate indexes

CodePudding user response:

Original because a background program in the call this SQL, lead to index and not on, then stopped background is plus
  • Related