There are four basic principles:
Establishing connections is expensive.
You ideally want to use the connection to do a fair bit of work to amortize the cost of spawning the backend process.
Each network round trip has some cost in terms of network latency.
As a result, submitting hordes of little queries that request little pieces of information can add up to being more expensive than submitting a small number of queries that aggregate together more of the data that you want into those few queries.
In particular, if one query is just naturally going to lead to another, where asking about an invoice will return a "pointer" to a sales document which will then provide a "pointer" to something else, it is quite likely to be cheaper to generate a query that asks the database backend to compute the whole trail and WHOOMP! return it as one query than it is to do a whole flurry of dozens of little queries.
It may (if used properly) improve security. It may also increase the cost of transmitting data across the network. That cost may be well worthwhile.
Frequently, most of the cost attaches to the process of establishing the connection, and so may be immaterial if amortized across a lot of work.
If this was useful, let others know by an Affero rating