Results 1 to 4 of 4

Thread: Select * from ......

  1. #1

    Thread Starter
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330

    Question

    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.

    A computer is a tool, not a toy.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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 .
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    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)

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Laziness...Isn't that one of the virtues of a programmer?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width