0

I am working with a custom ORM which writes mySQL queries. Basically, no matter what we want to evaluate in our WHERE clause of our mySQL statements, it starts with

WHERE TRUE AND...

My friend claimed that mySQL optimizes the query so the True will never affect the actual timing of the mySQL query. Is he right or is it worth my time to rewrite the ORM to no longer have the TRUE statement? I will eventually do this regardless because I hate how it looks and it was lazy code which caused this in the first place, but I need to know how high on my list of priorities this should be.

JoshKopen
  • 940
  • 1
  • 8
  • 22
  • 2
    [This question](https://stackoverflow.com/questions/242822/why-would-someone-use-where-1-1-and-conditions-in-a-sql-clause) might interest you. You can use `explain` to see if it impacts your queries at all; but it shouldn't. – RToyo Jun 08 '17 at 22:01
  • Thanks. I think the same principle probably applies to what I was asking but for some reason that particular question didn't come up in my search of the site. I appreciate it. – JoshKopen Jun 08 '17 at 22:35

0 Answers0