Reply to Re: am I doing unnecessary operations by mysql_fetch_array?

Your name:

Reply:


Posted by Captain Paralytic on 08/03/07 12:18

On 3 Aug, 09:37, David Gillen <Bel...@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.
> 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.
>
> D.
> --
> Fermat was right.

As well as what Micha said, there is another potential drawback.

Suppose someone added a TEXT BLOB field containing megabytes of data
to the table.
Any queries that used * would nowbe bringing back all that data each
time.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация