anyway the second way is better:
- You have only one call to database instead of two - so the channel between your DB and Application server is less loaded
- Second way usually should be faster and less memory consuming because analyser can decide better how to manage its resources (it has all the requirements in one query)
- In first example you force database to use not-cached queries (second query of the first example is not constant because in-list has different amount of inputs) so it parses the second query more often which leads to performance losses