There are various caching mechanisms in Mendix and in general queries are optimized as much as possible while still being able to generically build queries based on a domain model. A query where objects are retrieved over multiple associations on a very complex domain model won't be as fast as a simple query on a lone entity of course.
Data is not retrieved when it's not necessary anyway :) and schema's are used so not ALL data of a certain object is retrieved for a form where you only show 2 attributes.