|
Posted by Gary L. Burnore on 08/03/07 13:40
On Fri, 03 Aug 2007 13:06:51 +0200, Michael Fesser <netizen@gmx.de>
wrote:
>.oO(David Gillen)
>
>>If I want all column in a table though surely SELECT * is better.
>
>Depends.
>
>>In fact, performance on SELECT * is better than "SELECT field1, field2, field3,
>>field4, field5, field6, field7, field8" because mysql doesn't have to go
>>looking for the specific fields you've requested
>
>Did you test that or is it just a wild guess?
>
>>but just returns you
>>everything and since you know you want everything there is no problem.
>
>You shouldn't do the work of the optimizer, it knows better how to
>optimize a query in the most efficient way. There are at least two
>problems with SELECT * :
>
>1) It might return a lot of unnecessary columns, especially when doing
>complicated JOINs.
>
>2) The order in which the fields are returned might not always be the
>same. If your application depends on that (there are situations where
>this can be an issue), then it might fail at some time.
>
>Don't you think there's a reason why the MySQL team itself warns that
>you should _never_ rely on using SELECT *, except maybe for testing or
>debugging purposes?
I'm thinking he's not having this discussion in comp.databases.mysql
because he knows what the response will be. He was hoping he wouldn't
get the same response here. :)
--
gburnore at DataBasix dot Com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
===========================================================================
[Back to original message]
|