PDA

View Full Version : Take it all or what you need


Serge
08-08-2003, 01:02 AM
Is there really any difference in using the * to select everything for a table then just to select the stuff you need? I'm talking performance wise and if there is any security risks.

Erwin
08-08-2003, 01:53 AM
Selecting * will make the database retrieve all variable values - if you don't need to, don't do it, since it's going to waste time and resources.

g-force2k2
08-08-2003, 05:12 AM
i feel pretty much the same way as Erwin...

if you're selecting by using * and you're only using one or two rows of a table then you're sacrificing spd for getting data you don't necessarily need...

for instance if you're selecting doing a validation of a username and you only need the username and user then use:

$user = $DB_site->query_first( "SELECT userid, username FROM user WHERE userid=$bbuserinfo[userid]" );

rather then using SELECT *

just an example...

regards,
g-force2k2