SV: [PHP-DB] PHP/DB speed

2003-12-22 Thread Henrik Hornemann
Hi,

As others have pointed out, the real problem is the huge OPTION list.
You may however get a slightly lower time by using mysql_fetch_row
instead of mysql_fetch_array.

Regards Henrik Hornemann

-Oprindelig meddelelse-
Fra: Robin Kopetzky [mailto:[EMAIL PROTECTED] 
Sendt: 21. december 2003 23:16
Til: PHP DB Group
Emne: [PHP-DB] PHP/DB speed


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...

Thank for any help in advance.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

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

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



Re: [PHP-DB] PHP/DB speed

2003-12-22 Thread JeRRy

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



Re: [PHP-DB] PHP/DB speed

2003-12-22 Thread mike karthauser
 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.

Try the url with web analyzer
http://www.websiteoptimization.com/services/analyze/

This is by far the most useful dev tool I have found recently. Saves
touching dial ups for testing..
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



[PHP-DB] PHP/DB speed

2003-12-21 Thread Robin Kopetzky
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...

Thank for any help in advance.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

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



Re: [PHP-DB] PHP/DB speed

2003-12-21 Thread John W. Holmes
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...
Any time you put 2500 elements into a SELECT box, it's going to be slow. 
 The browser is going to take a noticable time rendering that box.

Are you actually building the option list up in a variable before 
displaying it or just echoing it outright? Building the whole thing up 
into a variable will take longer than just echoing it directly to the 
browser.

Other than that, if you're not willing to change your UI so you don't 
have a 2500 element select box, there's not much you can do.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP-DB] PHP/DB speed

2003-12-21 Thread Richard Davey
Hello Robin,

Sunday, December 21, 2003, 10:15:35 PM, you wrote:

RK The code I am using is thus and is retrieving around 2,500 records:

RK $result = mysql_query($sql)
RK while ($row = mysql_fetch_array($result))
RK {
RK build OPTION stmt
RK }

You're building a select list of 2500 elements? No wonder it's slow.
That must be generating a few hundred KB's worth of HTML on its own,
let alone anything else on the page.

If you're not using all 2500 rows, you need to optimise your query to
reflect this.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] PHP/DB speed

2003-12-21 Thread Miles Thompson
At 03:15 PM 12/21/2003 -0700, 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...
Thank for any help in advance.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020
Robin,

That's a huge option list. Just from the point of view of the user it is 
too large. Is there any way you can pare it down?

MySQL will select those records really quickly, but then the HTML has to be 
generated and the broser has to render the list. Try and rethink this if 
you can.

Regards - Miles Thompson 

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