[!--quoteo(post=378744:date=May 31 2006, 08:39 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 31 2006, 08:39 AM) [snapback]378744[/snapback][/div][div class=\'quotemain\'][!--quotec--] I have the following select box that gets filled on a page load. Everything else on the page gets loaded almost instantly (I'm on a LAN), but when I get to this part of the page, it takes several very long seconds to fill the select box. I use almost the same code in another setup, so I think the PHP is fine. I'm pretty much narrowing it down to the actual query, but I thought I'd post here and see if anyone sees something wrong with how I'm processing it. And I know the query is pretty involved, so I'm wondering if I broke it up a bit whether it would be faster!? [code] <?php $query = "SELECT HEADER_ID, CELL_NUMBER, END_DATE, TEST_NAME FROM EngineTestHeader WHERE TEST_TYPE_CODE IN ($ttcode) AND HEADER_ID IN (SELECT DISTINCT HEADER_ID FROM TransientCycleData) ORDER BY END_DATE DESC"; $result = $ehandle->update_query($query); if($result && mssql_num_rows($result) > 0) { // dump everything to the select box $i = 0; while($row = mssql_fetch_array($result)) { extract($row); $cell = $CELL_NUMBER; if(strlen(trim($CELL_NUMBER)) == 1) $cell = "0" . $CELL_NUMBER; echo "<option value=\"$HEADER_ID\">Cell $cell - " . @date("M d Y h:i A", strtotime($END_DATE)) . " - $TEST_NAME</option>"; } } ?> [/code] Oh, and the $ehandle->update_query() part is a custom class that I use. I know it's not that. [/quote] Its hard to know what would be slowing up your query without knowing how big your data set is and what you have indexed. You may want to try indexing some of the variables that you are trying to reference in the above query if they aren't already like HEADER_ID. What's in your $ttcode variable? Try doing a LEFT JOIN with TransientCycleData. Something like SELECT HEADER_ID, CELL_NUMBER, END_DATE, TEST_NAME FROM EngineTestHeader LEFT JOIN TransientCycleData ON (EngineTestHeader.HEADER_ID = TransientCycleData.HEADER_ID) Jon Tjemsland