0

This may be a no brainer as it seems to work alright, but are there any issues to using the 'IN' operator when you only have one item in the list? (it just seems to be more 'program friendly' to use IN since you don't have to vary syntax when there is multiple vs only one item value to check)

Scott
  • 7,983
  • 2
  • 26
  • 41
  • as opposed to using 'my_id' = 1, e.g. 'my_id' IN (1) – Scott Aug 18 '22 at 18:38
  • Someone found that Duplicate super quick :) This is definitely one of those things that it's worth running out the EXPLAIN plan for both statements and checking it out for yourself. When you submit SQL it first gets parsed so the computer can understand it, then it hits an optimization step where it makes decisions about how to execute what was asked of it via sql. Converting a single `IN` to an `=` is pretty common as are changes like predicate pushdown and the like. Some RDBMS will also convert large IN lists to temp tables and INNER JOIN even. The Explain plan will hold that info. – JNevill Aug 18 '22 at 19:02
  • ok, thanks. i did a couple of searches looking but apparently didn't land on the correct combination of search terms. I was more curious as to general issues. I'm not worried about performance in this instance (one-time-update) but may need to consider that in the future. – Scott Aug 19 '22 at 16:59

0 Answers0