Comment

Report: Trump Played Golf and Ignored the Puerto Rico Disaster Until He Saw Pictures on TV

106
Nerdy Fish9/29/2017 7:40:04 pm PDT

re: #105 Charles Johnson

Today I found a use for MySQL’s UNION operator for the first time, and it works great. I used it to check 3 different tables for a match against a certain value, with one query statement. And it’s really fast.

UNION and UNION ALL are pretty nice. It came in handy for a recent project where I needed to return a single dataset for two different logical queries. My development team wrote it as one big query with multiple WHERE clauses joined by an OR, which resulted in horrible performance (single-digit seconds even for an empty record set). Splitting those OR statements into two queries joined by a UNION ALL completely resolved that performance issue.