PDA

Click to See Complete Forum and Search --> : Select * from ......


Al Smith
Aug 6th, 2000, 12:32 PM
Hi,
I've noticed that most SQL examples on this and other sites begin with Select * from ... even if only a few fields are needed.
Many moons ago I was taught to explicitly select only the fields that you wanted to retrieve as this would reduce the overhead required to perform the query and greatly increase the speed.

Is this still true?

Thanks,
Al.

parksie
Aug 6th, 2000, 01:05 PM
Yes, but it's often easier in some situations to collect the entire set of fields. It's also not that different in time now, with todays processors. Although I still notice :).

Clunietp
Aug 6th, 2000, 02:09 PM
I would say that it is mostly out of laziness. Usually we are trying to prove a point OTHER than how to select individual columns, and using a * instead of individual field names makes the statement easier to read.

In practice, select only the fields you need (but we all get lazy sometimes, and as always, there are trade-offs involved no matter what you do)

parksie
Aug 6th, 2000, 02:21 PM
Laziness...Isn't that one of the virtues of a programmer?