Home > database >  SQL statement execution time is too long
SQL statement execution time is too long

Time:09-17

Dear bosses, please help to check the SQL where there is a problem, thank you very much!!!!!
Increase the final table of the execution time is 7 s, not associated end a list of the execution time is 0.6 s, 10 times of
Finally a list the amount of data is: 1.2 w

The SELECT Bus_TransferData. *, Bus_TransferData F_Unit AS F_UnitId
The FROM Bus_TransferData
INNER JOIN Bus_TransferInfo ON Bus_TransferInfo. F_Id=Bus_TransferData. F_TransferId
LEFT the JOIN Bus_DesignTask ON Bus_TransferData. F_TaskId=Bus_DesignTask. F_Id
LEFT the JOIN Bus_Project ON Bus_Project. F_Id=Bus_TransferData. F_ProjectId
LEFT the JOIN bus_projectbom ON Bus_DesignTask. F_BomId=bus_projectbom. F_Id
LEFT the JOIN Bus_PartInfo ON Bus_TransferData. F_PartId=Bus_PartInfo. F_Id
LEFT the JOIN Bus_PartInfo g ON Bus_TransferData. F_EquipmentId=g.F _Id
LEFT the JOIN bus_rawinfo_test ON Bus_TransferData. F_RawId=bus_rawinfo_test. F_Id

CodePudding user response:

Are there any indexes on 1. Field bus_rawinfo_test. F_Id?
2. The end result of how many? Can you use the paging (LIMIT)?

CodePudding user response:

First of all, you are the last LEFT JOIN Bus_TransferData, and the front have a lot of places to Bus_TransferData, such wording, should be an error,
In addition, you can see if the business logic, can change the LEFT JOIN to JOIN, after you have change, should be promoted,
And on the field of using, increase index,

CodePudding user response:

LEFT the JOIN bus_rawinfo_test ON Bus_TransferData. F_RawId=bus_rawinfo_test. F_Id, in bus_rawinfo_test. F_Id should have indexes, and execute the plan to use this index, that is to say, can't have a type conversion, character set does not match the limitation of factors such as the index,

CodePudding user response:

refer to the original poster Yp_Lou response:
, ladies and gentlemen, please help to check the SQL where there is a problem, thank you very much!!!!!
Increase the final table of the execution time is 7 s, not associated end a list of the execution time is 0.6 s, 10 times of
Finally a list the amount of data is: 1.2 w

The SELECT Bus_TransferData. *, Bus_TransferData F_Unit AS F_UnitId
The FROM Bus_TransferData
INNER JOIN Bus_TransferInfo ON Bus_TransferInfo. F_Id=Bus_TransferData. F_TransferId
LEFT the JOIN Bus_DesignTask ON Bus_TransferData. F_TaskId=Bus_DesignTask. F_Id
LEFT the JOIN Bus_Project ON Bus_Project. F_Id=Bus_TransferData. F_ProjectId
LEFT the JOIN bus_projectbom ON Bus_DesignTask. F_BomId=bus_projectbom. F_Id
LEFT the JOIN Bus_PartInfo ON Bus_TransferData. F_PartId=Bus_PartInfo. F_Id
LEFT the JOIN Bus_PartInfo g ON Bus_TransferData. F_EquipmentId=g.F _Id
LEFT the JOIN bus_rawinfo_test ON Bus_TransferData. F_RawId=bus_rawinfo_test. F_Id


Tuning is the key to the implementation plan, will you please send the implementation plan? thank you

CodePudding user response:

Increased from "end a list of the execution time is 7 s, not associated" a list of the execution time is 0.6 s, can know the final table of the associated field no index, or is not the only index, or the presence of large amounts of the default values are associated with many times,
  • Related