Will MySQLs query optimizer treat "IN(1,2,2)" as "IN(1,2)" ?

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

When determining the query execution plan, the MySQL query optimizer removes duplicate entries from an IN clause before it even looks at any indexes or data, doesn't it ? :scratchhead:

If it does, I'm thinking about padding a prepared statements bound params with the first element in the array. So things with one entry will look like "IN(1,1,1,1,1)" and the ones with multiples will be "IN(1,2,3,4,5)". My prepared statement will look like "IN(?,?,?,?,?)".
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: wpas and 121 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.