Jump to content

Recommended Posts

Here is the query I am currently using.

It seems to take forever. It keeps wanting to use filesort and a temporary can anyone plz help me. I will send the creates for both tables.

 

select collections.`id`,collections.`subject`,collections.`numfiles`,collections.`groups`,

collections.`size`,collections.`from`,collections.`date`,collections.`nfo`

FROM temp.collections,temp.nfo where match (nfo.nfo) against ('$searchterm' in boolean mode) and nfo.cid = collections.id order by `date` desc limit 0,50

 

CREATE TABLE `nfo` (

`id` mediumint(6) unsigned NOT NULL auto_increment,

`cid` int(10) unsigned NOT NULL,

`fid` int(10) unsigned NOT NULL,

`nfo` mediumtext NOT NULL,

`filename` varchar(200) NOT NULL,

PRIMARY KEY (`id`),

KEY `cid` (`cid`),

KEY `fid` (`fid`),

FULLTEXT KEY `nfo` (`nfo`)

) ENGINE=MyISAM AUTO_INCREMENT=152507 DEFAULT CHARSET=latin1

 

CREATE TABLE `collections` (

`id` int(10) unsigned NOT NULL auto_increment,

`subject` text NOT NULL,

`filename` text NOT NULL,

`numfiles` smallint(4) unsigned NOT NULL default '0',

`groups` text NOT NULL,

`partids` mediumtext NOT NULL,

`size` bigint(20) unsigned NOT NULL default '0',

`from` tinytext NOT NULL,

`date` int(10) unsigned NOT NULL default '0',

`group1` smallint(4) unsigned NOT NULL,

`group2` smallint(4) unsigned default NULL,

`group3` smallint(4) unsigned default NULL,

`group4` smallint(4) unsigned default NULL,

`group5` smallint(4) unsigned default NULL,

`nfo` int(10) unsigned NOT NULL default '0',

PRIMARY KEY (`id`),

UNIQUE KEY `filename_U` (`filename`(255)),

KEY `from` (`from`(50)),

KEY `date` (`date`),

KEY `Size` (`size`),

KEY `nfo` (`nfo`),

KEY `groupindex` USING BTREE (`group1`,`group2`,`group3`,`group4`,`group5`),

FULLTEXT KEY `Subject_full` (`subject`)

) ENGINE=MyISAM AUTO_INCREMENT=1865103 DEFAULT CHARSET=latin1 MIN_ROWS=100000 MAX_ROWS=2500000 AVG_ROW_LENGTH=500

Link to comment
https://forums.phpfreaks.com/topic/70307-i-need-help-optimizing-this-join/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.