4 ms·
"And it should request exactly the columns that are needed by the result" Gavin King (the Hibernate guy) argued that all columns should be fetched by default b
by ShabbyDoo 16y ago
"And it should request exactly the columns that are needed by the result"
Gavin King (the Hibernate guy) argued that all columns should be fetched by default because (A) the marginal cost of doing so is very low once the db has taken the disk hit for any data in the row and (B) an in-memory object cache is easy/efficient if entire objects (rows) are cached at once. I might be paraphrasing a bit much.
One could argue that, when some databases can return a subset of column data from indexes (vs eating the disk hit for the row data) that limiting the columns fetched could be much more efficient.
There are probably very few areas of any app I've worked on where I would have gotten significant performance gains by limiting results to a subset of columns.
- barrkel 16y agoIt depends. If there are a lot of columns and you're only interested in a handful, and there's an index that contains all those columns, it should be much cheaper just to select the interesting columns, as all the data needed can be retrieved from the index. Asymptotically, the size ratio between the columns selected and the columns in the table gives the speedup.