V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
YAFEIML
V2EX  ›  问与答

关于 mysql 的疑问。

  •  
  •   YAFEIML · 2015-07-20 14:24:38 +08:00 · 1860 次点击
    这是一个创建于 3195 天前的主题,其中的信息可能已经有所发展或是发生改变。
    爬了1万篇左右的文章,wordpress
    vps4核+2G内存

    打开后台mysql进程直接飙到200%(cpu)

    如果说没有访问量不大的话,1万篇文章不是应该只占用存储空间才对的吗?

    又不是说打开了后台就把所有文章都遍历了。

    这种情况会不会是环境或者是程序哪里出错了?
    第 1 条附言  ·  2015-07-20 16:30:44 +08:00
    日志来了,大牛们帮看下,要怎么处理呢!
    <code>
    /usr/local/mysql/bin/mysqld, Version: 5.5.42-log (Source distribution). started with:
    Tcp port: 3306 Unix socket: /tmp/mysql.sock
    Time Id Command Argument
    /usr/local/mysql/bin/mysqld, Version: 5.5.42-log (Source distribution). started with:
    Tcp port: 3306 Unix socket: /tmp/mysql.sock
    Time Id Command Argument
    # Time: 150720 15:44:47
    # User@Host: root[root] @ localhost []
    # Query_time: 1.731746 Lock_time: 0.000108 Rows_sent: 1 Rows_examined: 23720
    use wxbaowen.com;
    SET timestamp=1437378287;
    SELECT * FROM wp_posts WHERE ID = 23731 LIMIT 1;
    # Time: 150720 15:44:49
    # User@Host: root[root] @ localhost []
    # Query_time: 1.490322 Lock_time: 0.000096 Rows_sent: 5 Rows_examined: 27032
    SET timestamp=1437378289;
    SELECT wp_posts.* FROM wp_posts WHERE ID IN (27042,27040,27038,27036,27034);
    # Time: 150720 15:44:51
    # User@Host: root[root] @ localhost []
    # Query_time: 1.680649 Lock_time: 0.000124 Rows_sent: 10 Rows_examined: 3076
    SET timestamp=1437378291;
    SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (27034, 27036, 27038, 27040, 27042) ORDER BY t.name ASC;

    </code>
    4 条回复    2015-07-20 16:32:49 +08:00
    wohenyingyu01
        1
    wohenyingyu01  
       2015-07-20 14:25:39 +08:00
    好像是要先建立索引吧
    YAFEIML
        2
    YAFEIML  
    OP
       2015-07-20 14:27:09 +08:00
    @wohenyingyu01 这不是程序要干的事儿?
    qiayue
        3
    qiayue  
       2015-07-20 14:29:59 +08:00
    你看看你打开后台时执行的 sql 查询语句是什么,给相关字段简历索引
    如果你是用 phpmyadmin 管理 mysql 的话,直接上门点击就可以设置索引
    YAFEIML
        4
    YAFEIML  
    OP
       2015-07-20 16:32:49 +08:00
    @qiayue 帮看下吧,谢谢^^
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5464 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 07:00 · PVG 15:00 · LAX 00:00 · JFK 03:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.