I'd like to know, which option is the most expensive in terms of bandwith and overall efficiency.
Let's say I have a class Client
in my application and a table client
in my database.
Is it better to have one static function Client.getById
that retrieves the whole client record or many (Client.getNameById
, Client.getMobileNumberById
, etc.) that retrieve individual fields?
If a single record has a lot of fields and I end up using one or two in the current script, is it still better to retrieve everything and decide inside the application what to do with all the data?
I'm using PHP and MySQL by the way.