1
I have been wondered why outbox of Private Messages seems so slow in comparaison to inbox. Now I stumbled on this SQL definition and I think to know why.
CREATE TABLE priv_msgs (
msg_id mediumint(8) unsigned NOT NULL auto_increment,
msg_image varchar(100) default NULL,
subject varchar(255) NOT NULL default '',
from_userid mediumint(8) unsigned NOT NULL default '0',
to_userid mediumint(8) unsigned NOT NULL default '0',
msg_time int(10) unsigned NOT NULL default '0',
msg_text text,
read_msg tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (msg_id),
KEY to_userid (to_userid),
KEY touseridreadmsg (to_userid,read_msg),
KEY msgidfromuserid (msg_id,from_userid)
) TYPE=MyISAM;
I believe the last key should be the other way round:
KEY msgidfromuserid (from_userid,msg_id)