What is more preferable from the point of view of resource intensity, if you need a sample from the database with complex connections (join): one complex sql query or several simple queries with processing in java? What are some ways to test this in practice and compare the results?