logoalt Hacker News

Why MySQL OR is slower than IN

14 points • by millspore • last Saturday at 12:21 PM • 4 comments • view on HN

Comments

nathanfries • today at 7:11 AM

Why can't consecutive OR statements with common columns be reduced to IN? (I say consecutive since I assume ordering matters).

WHERE id = 1 OR id = 2... Should be abled to be reduced to WHERE id IN (1,2...)

However WHERE id = 1 OR name = 'John' OR id = 2 Maybe can't be reduced to WHERE id IN (1,2) OR name = 'John'

➕ show 1 reply
jodderayon • today at 7:35 AM

[dead]

tigerfalcon76 • last Saturday at 12:45 PM

[dead]

Sigmazero60 • last Saturday at 12:34 PM

[dead]