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 ALLshould certainly allow you to get the data back faster.What are you going to do with the data on the client, though? If you have to split it back it into 16 separate sets of data the overall execution time will probably increase.
Whatever you do, you only want one call to the database so if you leave it as 16 separate queries then it would be nice to have them all called in one stored procedure (or sub-stored procedures).