Two SQL queries or a for loop with two arrays? (in terms of cpu usage)

This is probabaly a pretty basic question but it has been on the back of my mind for awhile…

on a large scale, would it be more costly to execute two sql queries to get two arrays of data

or one query and sort the data after using foreach loops and such

Thanks!!