I've 16 queries that I need to execute. All these queries have the same format :
SELECT string, number, number
Make sense for me to group all these data together as it's to create a dashboard with all the results.
My question is : do you think a UNION ALL
will be faster then executing all the queries one by one?
UNION ALL
is faster than UNION
.
In case of UNION
, if you have 10 columns and 100 rows, it will compare each cell (i.e. 10*100) to get distinct values, while in UNION ALL
this is not the case. So the cost of getting distinct is high.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With