SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2001
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    query optimization

    If i have a table with the following structure:

    table stories
    --------------
    sid int(10)
    title varchar(100)
    time datetime
    author varchar(50)
    content text

    Will this query:

    select sid, title, time, author, content FROM stories

    be slower than using the following query which does not retrieve any
    value from the text field?

    select sid, title, time, author FROM stories

    thanks in advance

  2. #2
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    unless you're dealing with LOTS of data, it's not going to be even a slightly noticeable difference.
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2000
    Location
    Bangkok,Thailand
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    exbabylon is correct, but a good practise to get into regardless is only to query the columns of information you require - everything else is just uneccesary overhead - even if the difference in performance may well be minimal.

    It's kinda like cooking lasagna - you only prepare it with the ingredients you need - that way you get to eat it quicker. ;-)

    stuart
    http://www.travelfish.org


Bookmarks

Posting Permissions

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