I'm with Morbus on the clarity argument. And I also argue for better performance. It's not just the extra time the server needs to find the column names, but all of the extra data being buffered and sent over the wire. On large sites with load-balanced web server front ends, and mirrored or slaved database servers on the backend, operations people are usually trying to squeeze out every inch of performance possible from the site/database combined performance. Even though it may add only a millisecond per operation, when there are millions of operations being done, it quickly adds up. I'm well aware of the arguments against premature optimization, but given the arguments which Morbus presented, there's very little reason to not avoid "SELECT * " except when absolutely needed. ..chris On Fri, Feb 13, 2009 at 9:15 AM, Morbus Iff <morbus@disobey.com> wrote:
I give *little* regard for performance (in this case), and everything for my *expectations* and *documentation*. I could care less if it's faster or not. I care more about clarity.
David Metzler wrote:
Although there are merits in this argument, I wouldn't classify it as a bug. There's a lot of generic/abstracted data loading, and as long as there's code at there that dynamically adds columns, select * actually is the sanest way to do things.
Also, the performance costs are database dependent. Mysql may work one way, but other db's work another. Any DB with precompiled cached queries is not going to carry significant parsing overhead. The amount of data transfered in most cases is dependent on the size of the data in the column and not the number of columns. So in some tables it may make sense. You might get the name of the image file in drupal, but you're not likely to get the image.
Finally in my experience, most database performance problems lie in what is in the WHERE or JOIN, and not what's in the column list.
-- Morbus Iff ( masochism-oriented recombinant bot (unlisted series) ) Technical: http://www.oreillynet.com/pub/au/779 Enjoy: http://www.disobey.com/ and http://www.videounderbelly.com/ aim: akaMorbus / skype: morbusiff / icq: 2927491 / jabber.org: morbus