Tag: or
Rewrite OR to UNION in PostgreSQL queries
Rewriting OR is not always the best solution © Laurenz Albe 2022 In my article that reviles OR, I showed how in certain cases, it is possible to rewrite OR in a WHERE condition to a longer query with UNION that can perform much better (the “ugly” OR). Now people have asked me repeatedly why […]
Read more
Avoiding “OR” for better query performance
PostgreSQL query tuning is our daily bread at CYBERTEC, and once you have done some of that, you’ll start bristling whenever you see an OR in a query, because they are usually the cause for bad query performance. Of course there is a reason why there is an OR in SQL, and if you […]
Read more