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

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

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

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • javascript中Date常用方法[通俗易懂]

    javascript中Date常用方法[通俗易懂]一、Date的构造函数有四种形式的Date构造函数:二、返回日期对应的毫秒数1.Date.parse()Date.parse()接收一个日期字符串,返回该日期对应的毫秒数。2.Date.UT

    2022年7月3日
    25
  • pycharm django开发_django项目实例精解

    pycharm django开发_django项目实例精解1.首先按往常“NewProject”创建新项目2.在下方Terminal终端输入django-adminstartprojectroomroom是我的项目名称3.新建app目录pythonmanage.pystartappappapp是我起的名称,可以换成其他的4.运行在终端cd进入manage.py路径后输入命令pythonmanage.pyrunserver8000点击此处链接就可以了这是运行成功界面。参考自https://www.jianshu.com

    2022年8月28日
    3
  • ORA-00904: “NAME”: 标识符无效

    参考上面的https://blog.csdn.net/qq_21383435/article/details/94459706插入语句为selectid,namefromUSERS因为没有区分大小写,所以报错,改成大些就好了selectID,NAMEfromUSERS…

    2022年4月5日
    90
  • visual studio2015 密钥_visualstudio2013

    visual studio2015 密钥_visualstudio2013参考自:《visualstudio2012密钥》https://zhidao.baidu.com/question/555696036850635212.htmlvs2012密钥序列号(保证完美激活);YKCW6-BPFPF-BT8C9-7DCTH-QXGWCRBCXF-CVBGR-382MK-DFHJ4-C69G8YQ7PR-QTHDM-…

    2022年10月14日
    3
  • react-router4的按需加载实践(基于create-react-app和Bundle组件)

    react-router4的按需加载实践(基于create-react-app和Bundle组件)

    2022年4月2日
    46
  • nginx和apache的区别,选择哪个好?

    nginx和apache的区别,选择哪个好?Apache和Nginx最核心的区别在于apache是同步多进程模型,一个连接对应一个进程;而nginx是异步的,多个连接(万级别)可以对应一个进程。下面本篇文章就来给大家介绍一下Apache和Nginx的区别有那些,选择哪个好?希望对你们有所帮助。一、Nginx特点  1、轻量级,采用C进行编写,同样的web服务,会占用更少的内存及资源。  2、抗并发,nginx以epollandkqueue作为开发模型,处理请求是异步非阻塞的,负载能力比apache高很多,而apache则.

    2022年5月24日
    37

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

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