This question is very much near to what I wanted to ask, but both question and answers are focusing more on selecting random rows.
Since there is general rule that, "SELECT COLUMN_LIST" is always recommended over "SELECT *", I wanted to know whether the recommendation changes with the below scenario.
Scenario: From a table having about 5 columns, if I need information of those 5 columns, but at different steps,
Eg: Like in a Java function, at Step 1, first 2 columns will be used and at Step 4, column 3 and column 4 will be used and at Step 10, 5th column will be used.
There are 2 ways to get these information,
- Make 1 DB call, with "SELECT *" and extract required information at respective steps.
- Make multiple DB calls, with "SELECT COLUMN_LIST" at Step 1, Step4 and Step 10, fetching only required column's data, in each call.
Which of the 2 ways is recommended for the above scenario?