4 ms·
tl;dr If you have indexes on column A but not B selecting * (a+b) will also need to fetch the row, otherwise it can fetch only the index. The end. To be fair
by Justsignedup 6y ago
tl;dr
If you have indexes on column A but not B selecting * (a+b) will also need to fetch the row, otherwise it can fetch only the index.
The end.
To be fair, I've been using sql and optimizing it for a decade. The number of times "select *" was the offender was a minority. Typically N+1 is the biggest performance issue in modern frameworks and newer developers. Following that is complex logic that can be simplified to a more efficient sql.
select (star) is so far down the causes of slowdowns it is hardly worth mentioning 95% of the time.
0% of the time was db->server bandwidth the issue. Otherwise you're probably fetching a gig of data instead of filtering it in sql or paging.