You may want to try a few things. (1) All queries are run inside functions. I don't do any work inside (2) These functions are always called from a wrapper function, which includes reporting the time to run just the query. GetOrderNumber(MyOrderNumber, &$DS_Order) { global $QueryTimers; $QueryStartTimer = microtime(); $Sql = "SELECT **** FROM orders WHERE OrderNumber = " . MyOrderNumber; $Result = mysql_query( $Sql ); $QueryEndTimer = microtime(); $QueryTimers[] = $QueryEndTimer - $QueryStartTimer; // check for and handle errors gracefully // return false if there are any problems // return true if successful } output code .... $QueryTimers = array(); .... code here .... .... GetOrderNumber(MyOrderNumber); .... more code .... Then, at the bottom of my pages, in a footer file, I have output along the lines of "total query time = 0.15s (2 queries) // total page loading = 3.21s". This helps me know efficient my pages are. This will give you an idea of what is taking so long. My work is all on a company intranet, so I don't have a problem with displaying these values. Your mileage may vary. As far as getting queries to run faster... (a) I have found that it can be much faster to have multiple queries instead of overly complicated joins. Although not too bad with inner joins, your left, right, and Cartesian joins can be big resource hogs. (b) Look at your selection criteria. You want to put the selection criteria that will eliminate the most data first in the WHERE clause. (c) Avoid using "SELECT *...". Your queries will be faster if you select the specific columns that you want, even if you want all columns in a particular table. Thank you, Jarrett No trees were harmed during this transmission; however, several electrons were terribly inconvenienced. ----- Original Message ---- From: Harpreet <harpreet@xxxxxxxxxxxxxxx> To: php-windows@xxxxxxxxxxxxx Sent: Friday, February 9, 2007 10:27:31 AM Subject: PHP rendering I have a sql query which takes like 6 seconds to return results when run in query analyzer but when used via a php webpage to display in a report it take over 15 seconds. What can be the reason for the page to take so long to return results. Any help is appreciated. Thanks Harpreet Kaur -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php