Home > database >  Mysql multi-table query left join performance degradation
Mysql multi-table query left join performance degradation

Time:09-25

There is frequent talk of a multi-table LianZha will waste a lot of performance and CPU
Reason is that when LianZha is performed first left the join and then execute the where statement, generated by the temporary table data will be great
But I test to find and is not expected...
 
The SELECT OS. Id, app id, oi. Id, oo. Id FROM osx as OS
LEFT the JOIN appx as app ON app. Id=OS. The app_id
LEFT the JOIN oix as oi ON oi. Order_sn=OS. Order_sn
LEFT the JOIN oox as oo ON oo. Order_sn=OS. Order_sn
WHERE OS. Od_id BETWEEN 100 AND 110

As above article 10 data, the execution time of 0.01 seconds

The osx/oix oox amount of data that are in more than 100 w, if according to the left first join the routines, how also get come in seconds?
Where is my wrong?

CodePudding user response:

Certainly not combined to generate a huge table first, then filtering, can understand related query process is introduced

CodePudding user response:

Mysql will join query is slow, because before 8 is no hash join, propose a change in wording,

CodePudding user response:

OS the table first found out, in the temporary table, then connected to the other table,
The rest is literally you play,

CodePudding user response:

OS the table first found out, in the temporary table, then connected to the other table,
The rest is literally you play,
  • Related