Hi,

        I have the following query and everytime i try to run it, it returns an
error "Mysql server has gone away". Is it beacause the query is very slow?
If so, how can i speed it up?

Query ->
SELECT a.idemail, a.fklastresp
FROM wmkt_email a, wmkt_client b, wmkt_maillist_client c
WHERE bActive AND b.fkemail NOT IN (1, 2 <- about 130.000 values -> )
AND c.fkmaillist IN (2) AND a.idemail=b.fkemail AND c.fkclient=b.idclient
ORDER BY fklastresp LIMIT 5000

Tables structures ->
--------------------------------------------------------
Table,Create Table
wmkt_email,CREATE TABLE `wmkt_email` (
  `idemail` int(11) NOT NULL auto_increment,
  `email` varchar(255) NOT NULL default '',
  `fklastresp` int(11) NOT NULL default '0',
  PRIMARY KEY  (`idemail`),
  UNIQUE KEY `ixEmail` (`email`)
) TYPE=MyISAM

--------------------------------------------------------
Table,Create Table
wmkt_client,CREATE TABLE `wmkt_client` (
  `idclient` int(11) NOT NULL auto_increment,
  `realname` varchar(80) NOT NULL default '',
  `fkemail` int(11) NOT NULL default '0',
  `dtInsert` datetime default NULL,
  `dtLastUp` datetime default NULL,
  `fkuser` int(11) NOT NULL default '1',
  PRIMARY KEY  (`idclient`),
  KEY `ixFkemail` (`fkemail`)
) TYPE=MyISAM

---------------------------------------------------------
Table,Create Table
wmkt_maillist_client,CREATE TABLE `wmkt_maillist_client` (
  `fkmaillist` int(11) NOT NULL default '0',
  `fkclient` int(11) NOT NULL default '0',
  `dtInsert` datetime default NULL,
  `bActive` tinyint(4) NOT NULL default '1',
  KEY `ixEmailList` (`fkmaillist`,`fkclient`)
) TYPE=MyISAM


Thank u very much,
Edilson.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to