mediumtext java_加快此查询(加入mediumtext字段)「建议收藏」

mediumtext java_加快此查询(加入mediumtext字段)「建议收藏」我有这个问题SELECTt.name,t.userid,t.date,t.cat_id,t.forum_id,t.reply,t.hidden,t.moderated,t.sticky,t.statut,t.poll,t.helpful,t.del,t_data.message,user.nameASauthor_name,user.levelASauthor_level,user….

大家好,又见面了,我是你们的朋友全栈君。

我有这个问题

SELECT t.name,t.userid,t.date,t.cat_id,t.forum_id,t.reply,t.hidden,t.moderated,t.sticky,t.statut,t.poll,t.helpful,t.del, t_data.message, user.name AS author_name,user.level AS author_level,user.is_globalMod AS author_global,user.award, user.statut AS author_statut,user.posts AS user_posts,user.point AS user_points,user.title AS user_title, user.image AS user_avatar,user.sex AS user_sex,user.other_level,user.hid_posts FROM frm_thread AS t LEFT JOIN frm_thread_data AS t_data ON t_data.thread_id = t.id LEFT JOIN frm_member AS user ON user.id =t.userid WHERE t.id = 248925

frm_thread是

CREATE TABLE IF NOT EXISTS frm_thread ( id mediumint(7) unsigned NOT NULL auto_increment, last_userid int(10) unsigned NOT NULL, last_date int(10) unsigned default NULL, forum_id tinyint(5) unsigned NOT NULL, cat_id tinyint(3) unsigned NOT NULL, name varchar(250) collate utf8_unicode_ci NOT NULL, userid int(10) unsigned NOT NULL, date int(10) unsigned default NULL, view mediumint(5) unsigned NOT NULL, reply smallint(4) NOT NULL, sticky tinyint(1) unsigned NOT NULL, linked tinyint(1) unsigned NOT NULL, linked_order tinyint(2) unsigned NOT NULL, spam tinyint(1) unsigned NOT NULL, statut tinyint(1) unsigned NOT NULL, moderated tinyint(1) unsigned NOT NULL, hidden tinyint(1) unsigned NOT NULL, poll smallint(5) unsigned NOT NULL, del tinyint(1) unsigned NOT NULL, t_icon smallint(10) unsigned NOT NULL, helpful int(10) unsigned NOT NULL PRIMARY KEY (id), KEY forum_id (forum_id), KEY last_date (last_date,date,sticky), KEY linked (linked), KEY date (date), KEY userid (userid), KEY last_userid (last_userid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=249014 ;

frm_thread_data

CREATE TABLE IF NOT EXISTS frm_thread_data ( thread_id int(10) unsigned NOT NULL, message mediumtext collate utf8_unicode_ci NOT NULL, PRIMARY KEY (thread_id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

正如你所看到的,消息内容在一个单独的表中,现在这个查询正常在0.0005中完成,由codeigniter分析显示

有些时候它需要25.0050秒

我有一个帖子表,但文本字段不在一个单独的表中,它总是给出一个接近0.0020的数字

请问有什么方法可以解决这个问题吗?

EXPLAIN SHOW’s

id select_type表类型possible_keys键key_len ref rows Extra

1 SIMPLE t const PRIMARY PRIMARY 3 const 1

1 SIMPLE t_data const PRIMARY PRIMARY 4 const 1

1 SIMPLE用户const PRIMARY PRIMARY 4 const 1

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/132196.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号