YAFEIML
V2EX  ›  问与答

关于 mysql 的疑问。

  •  
  •   YAFEIML · Jul 20, 2015 · 2503 views
    This topic created in 4020 days ago, the information mentioned may be changed or developed.
    爬了1万篇左右的文章,wordpress
    vps4核+2G内存

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

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

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

    这种情况会不会是环境或者是程序哪里出错了?
    Supplement 1  ·  Jul 20, 2015
    日志来了,大牛们帮看下,要怎么处理呢!
    <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 replies    2015-07-20 16:32:49 +08:00
    wohenyingyu01
        1
    wohenyingyu01  
       Jul 20, 2015
    好像是要先建立索引吧
    YAFEIML
        2
    YAFEIML  
    OP
       Jul 20, 2015
    @wohenyingyu01 这不是程序要干的事儿?
    qiayue
        3
    qiayue  
       Jul 20, 2015
    你看看你打开后台时执行的 sql 查询语句是什么,给相关字段简历索引
    如果你是用 phpmyadmin 管理 mysql 的话,直接上门点击就可以设置索引
    YAFEIML
        4
    YAFEIML  
    OP
       Jul 20, 2015
    @qiayue 帮看下吧,谢谢^^
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4377 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 10:09 · PVG 18:09 · LAX 03:09 · JFK 06:09
    ♥ Do have faith in what you're doing.