Hi - I'm running a website on MySQL (PHPNuke/ phpBB/ Coppermine etc. etc.) - one of the queries generated by a modification of phpBB is taking a really long time to execute. I've recorded it taking up to 12 seconds to run - which is slowing down the website no end.
Here is an example of the query:
And here is a structure dump from the two tables involved:
Does anyone have any suggestions on either a better syntax for the SQL query - or changes to the two tables (adding indexes maybe?)
Any suggestions or comments would be greatly appreciated as this query is crippling my website.
Cheers
Tama
Here is an example of the query:
Code:
'SELECT a.post_id, d.* FROM nuke_bbattachments a, nuke_bbattachments_desc d WHERE ( a.post_id IN (134922, 134926, 134930, 134935, 134952)) AND (a.attach_id = d.attach_id) ORDER BY d.filetime ASC'
And here is a structure dump from the two tables involved:
Code:
CREATE TABLE `nuke_bbattachments` (
`attach_id` mediumint(8) unsigned NOT NULL default '0',
`post_id` mediumint(8) unsigned NOT NULL default '0',
`privmsgs_id` mediumint(8) unsigned NOT NULL default '0',
`user_id_1` mediumint(8) NOT NULL default '0',
`user_id_2` mediumint(8) NOT NULL default '0',
KEY `attach_id_post_id` (`attach_id`,`post_id`),
KEY `attach_id_privmsgs_id` (`attach_id`,`privmsgs_id`)
) TYPE=MyISAM;
CREATE TABLE `nuke_bbattachments_desc` (
`attach_id` mediumint(8) unsigned NOT NULL auto_increment,
`physical_filename` varchar(255) NOT NULL default '',
`real_filename` varchar(255) NOT NULL default '',
`download_count` mediumint(8) unsigned NOT NULL default '0',
`comment` varchar(255) default NULL,
`extension` varchar(100) default NULL,
`mimetype` varchar(100) default NULL,
`filesize` int(20) NOT NULL default '0',
`filetime` int(11) NOT NULL default '0',
`thumbnail` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`attach_id`),
KEY `filetime` (`filetime`),
KEY `physical_filename` (`physical_filename`(10)),
KEY `filesize` (`filesize`),
KEY `attach_id` (`attach_id`)
) TYPE=MyISAM;
Does anyone have any suggestions on either a better syntax for the SQL query - or changes to the two tables (adding indexes maybe?)
Any suggestions or comments would be greatly appreciated as this query is crippling my website.
Cheers
Tama