php/sql advice

Discussion in 'PHP' started by Funk-woo10, Jul 2, 2008.

  1. #1
    Hi, what performs better i have 2 tables joined, probably no more then 20 cols.

    What is better for performance if i use wild card and select all or if i select the exact cols i need ?

    Just wondering what is better performance wise ?
     
    Funk-woo10, Jul 2, 2008 IP
  2. clarky_y2k3

    clarky_y2k3 Well-Known Member

    Messages:
    114
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    108
    #2
    It depends on how many fields you need, if it's most of them then you may as well go ahead and use a wildcard to save having a long list of fileld names.

    Otherwise just select the fields you need, it will be save resources.
     
    clarky_y2k3, Jul 2, 2008 IP
  3. Funk-woo10

    Funk-woo10 Peon

    Messages:
    1,108
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thats what i was thinking. ta
     
    Funk-woo10, Jul 2, 2008 IP
  4. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    When you don't need all the columns, its always better to list the columns you need, rather than using wild card! The performance difference could be very big if you're working with a lot of data, though that's not the case. The only 'bad' thing about listing the columns is that you need to do it (writing some column names is harder than writing a simple wild card :p )
     
    xlcho, Jul 2, 2008 IP
  5. Funk-woo10

    Funk-woo10 Peon

    Messages:
    1,108
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #5
    spot on. ta
     
    Funk-woo10, Jul 2, 2008 IP