Why limit the number of selected columns - quick-perf/doc GitHub Wiki
Selected columns that you don't need can impact performance, particularly when you select all columns.
Not selecting everything can save memory in the database and JVM sides and reduce IO between the JVM and the database.
Also, unwanted columns can prevent some index-only scans that avoid table access, saving a lot of IO. Preventing index-only scans can seriously limit performance.
We invite you to view a part of this talk from Lukas Eder and Vlad Mihacea (to 56:00). It explains some negative impacts of selecting too many columns.
When you need some specific read-only data, as could be the case with DTOs, it is recommended to project the necessary columns. Examples can be found here or here to do this with JPA, Hibernate, or Spring.
With the ExpectSelectedColumn QuickPerf annotation, we can quickly check the number of selected columns.