|
Posted by Gary L. Burnore on 08/03/07 13:36
On 03 Aug 2007 08:37:05 GMT, David Gillen <Belial@RedBrick.DCU.IE>
wrote:
>C. said:
>> On 2 Aug, 10:04, Michael Fesser <neti...@gmx.de> wrote:
>>> You shouldn't use "SELECT *" in production code, list all columns
>>> explicitly.
>>>
>>> Micha
>>
>> You shouldn't use "SELECT *" in production code IF YOU CAN list all
>> columns
>> explicitly.
>>
>> ...reason being that you're loading more data into the mysql buffer
>> than you need, then it gets copied into the PHP variable space.
>>
>If I want all column in a table though surely SELECT * is better.
Not in all cases and especially not in an environment where there
might be things like upgrades that change the table structure. Add a
huge field to an existing table and * becomes a bad thing.
>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 but just returns you
>everything and since you know you want everything there is no problem.
Uh, no. That's not correct. You've got it backwards. If you specify
the fields, mysql knows to use them, if you use *, mysql needs to
figure out what the fields are.
It is recommended that you don't use * for production work.
--
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
===========================================================================
Navigation:
[Reply to this message]
|