Tag Archives: or

mySQL: OR, UNION and UNION ALL

I was doing some SQL tuning on mySQL today and I learned a few interesting things. Let’s take an example of a simple query where we have an OR of two mutually exclusive conditions, each on indexed columns. SELECT * FROM   t1 WHERE  user_id = 1 OR     location_id = 2; In mySQL there is a […]