Home > database >  Mysql millions of queries how fast query
Mysql millions of queries how fast query

Time:09-27

Students table, student id, name, age
Class table - class id, class name
Students class association table, primary keys, student id, class id

Each table 300 w data, find out students class all data association list details

Mysql millions of queries how fast query,
This statement query to more than 50 seconds, requirements in 5 seconds, but business to stay here, don't know how to optimize SQL

SELECT
Sc. Student_class_id,
Sc. Student_id,
S.s tudent_name,
S.s tudent_age,
Sc. Class_id,
Arthur c. lass_name
The FROM
Student_class_rel sc
Left the JOIN class c ON Arthur c. lass_id=sc. Class_id
Left the JOIN student s ON s.s tudent_id=sc. Student_id



CodePudding user response:

The two key fields indexed? Pro -

CodePudding user response:

Apparently time mostly in the FROM
Student_class_rel sc on this, in addition to increase the speed of hardware, no good method,

CodePudding user response:

What business should be displayed at once the amount of data of 300 w? Tidy up the data sent to the display alone need a long time,,,

CodePudding user response:

This problem is a little pit dad ah, try to use postgresql, hash join will be faster, but should be less than 5 seconds

CodePudding user response:

Indexed, paging, one-time check database of 300 w, looks a little pit
  • Related