NYCPHP Meetup

NYPHP.org

[nycphp-talk] Sssllllooooowwwww Page

harvey list at harveyk.com
Tue Mar 8 12:06:11 EST 2005


Hello NYPHP,

I've got a page that works totally fine for me. Takes a few seconds to load 
on cable connection with IE 6 PC. Works fine for a colleague with DSL on 
the Mac (not sure which browser). But for the most important person 
(client!) the page is taking over a minute and a half to load. He's on Win 
XP and IE (probably 6) with cable connection.

Relevant details are below. Basically, there's a table of shows, a table of 
bands, and a table that connects the two so you know which bands are 
playing in which shows. The admin chooses a show and sees a list of about 
500-1000 bands with the current bands for that show already checked. The 
admin can uncheck them, check others, etc, and update the show.

Any ideas if the slowness in loading might be due to the select statement? 
Is there a more efficient query structure? Or maybe just writing the 1000 
form inputs is taking too long? I was thinking about getting rid of the 
show/band array table and just adding 10 fields to the show table: 
band1_fid, band2_fid, etc... That would probably speed things up, but all 
the work was already done for the current  method and it works totally fine 
(except too slow for the client)...

Thanks in advance for any suggestions!

Harvey


$show_id is a passed variable

music_bands:  (List of bands)
band_id
band_name

music_show_bands_array: (Keeps track of which bands are in which shows)
s_b_id
show_fid
band_fid

SELECT music_bands.band_id AS id, music_bands.band_name AS band, 
music_show_bands_array.s_b_id AS inthere
FROM music_bands
LEFT JOIN music_show_bands_array ON ((music_show_bands_array.band_fid = 
music_bands.band_id) AND (music_show_bands_array.show_fid = $show_id))
ORDER BY music_subcats.subcat_name ASC

Then there's a form with about 500-1000 bands listed as follows:
<?php do { ?>
<input name="band_fid[]" type="checkbox" value="<?php echo 
$row_bands['id']; ?>" <?php if ($row_bands['inthere']) { echo " checked"; } ?>>
<?php } while ($row_bands = mysql_fetch_assoc($bands)); ?>






More information about the talk mailing list