Easy java backend

No SELECT *

The 30 second answer

I select only the columns I need instead of everything. That means less data read, sent over the network and turned into objects, and it allows index-only scans when the selected columns are in an index. It also protects the API from accidentally exposing new columns and from breaking when someone adds a large text or binary column later.

Selecting only the columns you need sends less data and makes index-only scans possible, since an index can only cover the columns you ask for.

Sources (2)
  1. Use The Index, Luke: Index-Only Scan
  2. PostgreSQL 17: Index-Only Scans