If you're retrieving a list of objects in a microflow and then only use it to perform a list aggregation operation on it, Mendix will automatically optimize this and perform that aggregation directly on the database.
In other words, if you would retrieve the order lines and count them in a microflow, Mendix will only perform a "SELECT COUNT(*) FROM ...
" query on the database and never actually retrieve all the order line objects.