Home > database >  Questions about the efficiency of the in keyword
Questions about the efficiency of the in keyword

Time:10-10

Dear Daniel, the younger brother novice, want to ask a few questions:

1. If I use
 select * from where the primary key Id in () 
the explain found using range, and use the
 select * from where the primary key index but also in () 
the explain and use the range, the two efficiency gap in where? Efficiency difference big?

2. If I use a for loop, each loop using the
 select * from where the primary key Id=
if you don't use cycle,
 select * from where the primary key Id in () 
the efficiency of the two methods, is there a difference?

Thank please Daniel can guidance to us

CodePudding user response:

More than 1 of the primary key index step back to fetch the data table

2 use a for loop increasing network consumption, with higher in efficiency

CodePudding user response:

1. The primary key index is certainly no primary key index of high efficiency
2. High efficiency than the for loop in
  • Related