For a while I was sure that UNION ALL had better performance when dealing with multiple matches from SELECT * FROM table. But recently I revisited my code and the performance is negligible. My code is…