Re: PHP/DB speed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robin Kopetzky wrote:
> Good afternoon!
> 
> 	I am writing a project and have a speed concern...
> 
> 	The code I am using is thus and is retrieving
around 2,500 records:
> 
> 	$result = mysql_query($sql)
> 	while ($row = mysql_fetch_array($result))
> 	{
> 		build <OPTION> stmt
> 	}
> 
> 	Is there a faster method? Timed this with microtime
and .9 seconds 
to
> retrieve the data and output the web page seems REAL
slow. Now this 
is on a
> T-Base-100 network but I imagine it would be like
watching paint dry 
in a
> 56K modem. Any thoughts, ideas on accelerating this?
I did try 
ob_start()
> and ob_end_flush() and no help...

Ouch, .9 Seconds, is this 9 seconds or 90 seconds? 
I'm guessing .9 is 90.  

Never the less 9 or 90 is slow.  But what do you
expect when your draging down 2,500 records in a
<OPTION> statement.  The poor HTML is working alot and
the browser has to render it.  This takes time. 
That's a fair bit of HTML.

Try grabbing 2,500 records of abc with <b> around it
and <center> for each abc and display it as plain text
and see how long it would take.  Probably the same
speed wise.

Why would you need 2,500 <OPTION> anyways.  The poor
old user would be there for at least 5 mins deciding
or finding the one to click.  This is some project.

An easy way is to diplay all data in plain text and
have the user simply typing what they want.  You could
than run the results against the database for a match
and if one found process it.  If the user types some
bogus thing that is not in the list return a error.

That be alot faster in speed wise.  But again it comes
back to the user selecting taking ages to sift through
so many records.  It depends what their selecting
also, if it's like a sport name you could customize
them in alphabetical order or Occupation or something
can work the same.  (be easier for user to find)

Another way, not sure how speed would go is to have a
radio button or check box down one side of the page. 
Give each a unique id name (e.g. 1 , 2 , 3) and
display the data to the right of it so they select
one.  Than you run a query to match the id against the
database which will find the data to match it with. 
But that method I'd guess would be slightly QUICKER
than the OPTION method.  But only a bit faster,
nothing crash hot as the browser still needs to render
the HTML.

On 56K the page would probably either 1) timeout on
the way you have it currently or 2) only display part
of the page/form and not read the whole page
correctly.

I dunno give us the URL, I am sure someone is on
dialup to give it a wurl.  

Goodluck :)




http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux