Peter and Hugh,

The queries are already mostly optimized. I just was using that one as an 
example. I'll be going through them and tweaking them, but know that about 
the variable assignments helps for sure. 

Thanks!


On Thu June 26 2003 10:49 pm, Peter Beckman wrote:
> Since this is the PHP DB list, I can tell you this -- you would be better
> off performance-wise replacing the "*" in "select * from" and replacing it
> with a list of the columns (even if it is all of them) than you would
> putting all of that on one line.
>
> $r = rand(0,7)*-1;
> $s = abs($r);
>
> is as fast as (maybe a few CPU cycles, but when you're talking 2GHz
> processor, eh)
>
> $s = abs(rand(0,7)*-1);
>
> The second is probably more elegant, but then again, you still have to
> check to see what $data contains -- the DB might not have returned a row
> (for some unknown reason).
>
> Optimize DB calls before compacting variables.  I'm all about writing
> compact optimized code, but your DB calls and DB layout (indexes and
> queries mostly, but also table design) cost the most performance-wise and
> you're better off spending time getting them better.
>
> I highly recommend:
> http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Optimisatio
>n.html#Estimating_performance
>
> Peter
>
> On Thu, 26 Jun 2003, Hugh Bothwell wrote:
> > "Micah Stevens" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> > > $data = mysql_fetch_assoc(mysql_query("select * from some_table limit
> >
> > 1"));
> >
> > > would be faster than:
> > >
> > > $pointer = mysql_query("select * from some_table limit 1");
> > > $data = mysql_fetch_assoc($pointer);
> > >
> > > but I'm not sure, php may optimize this. Anyone know the answer?
> >
> > It will be faster by one store and one fetch... the
> > database query probably takes 1000 times as long.
> > I don't think the difference is worth the time you'd
> > take to change it.
> >
> > --
> > Hugh Bothwell     [EMAIL PROTECTED]     Kingston ON Canada
> > v3.1 GCS/E/AT d- s+: a- C+++ L++>+++$ P+ E- W+++$ N++ K? w++ M PS+
> > PE++ Y+ PGP+ t-- 5++ !X R+ tv b++++ DI+++ D-(++) G+ e(++) h-- r- y+
> >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> ---------------------------------------------------------------------------
> Peter Beckman                                                  Internet Guy
> [EMAIL PROTECTED]                             http://www.purplecow.com/
> ---------------------------------------------------------------------------


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to