It often makes sense to fetch only what you need for example if I should display only 10 rows of data then I should not fetch the entire data set because it would waste resources for a large data set. A practical example is the SQL Limit keyword. select * from users order by added limit 10I wonder if we can connect that to a software principle. There is the keep-it-simple principle but maybe it is a case of rule of the least power but for data instead of programs?
Which principle is it to fetch only needed data?
principles;workload estimation
Requesting only what you need is not a software principle; it's a matter of common sense (and perhaps courtesy against other users of the same system).There is a related point about of architecture, though: the system should allow users to request only 10 lines rather than everything! APIs can be held to different criteria: completeness, ease of use, minimality, elegance, consistency etc. A data source that allows you to select only single records wouldn't be pleasant to use if you do need 10 records. An API that only allows you to download everything and sort it out yourself would be even worse, even though it would be complete, minimal and very consistent.Therefore the connecting point is that even a very simple task can demonstrate that engineering principles usually conflict with each other, and the trade-off has to be considered carefully.