› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
nvhanzhi
V2EX  ›  MySQL

小白求救,也没有熟悉 mysql 的大佬帮我写几个索引啊,跪谢!

  •  
  •   nvhanzhi · Apr 29, 2023 · 2550 views
    This topic created in 1250 days ago, the information mentioned may be changed or developed.

    我用插件查出来的,我的 wordpress 排名前几的搜索都很慢,求大佬支援。。。

    SELECT ibz_posts.ID FROM ibz_posts LEFT JOIN ibz_term_relationships ON (ibz_posts.ID = ibz_term_relationships.object_id) WHERE 1=1 AND ( ibz_term_relationships.term_taxonomy_id IN (i) ) AND ((ibz_posts.post_type = s AND (ibz_posts.post_status = s))) AND ( NOT EXISTS (select * from ibz_term_relationships tr inner join ibz_term_taxonomy tt on tr.term_taxonomy_id = tt.term_taxonomy_id where tt.taxonomy = s and ibz_posts.ID = tr.object_id AND tr.term_taxonomy_id IN (i))) ORDER BY ibz_posts.post_date DESC, ibz_posts.ID DESC LIMIT 0, 12

    UPDATE ibz_postmeta SET meta_value = s WHERE post_id = i AND meta_key = s

    SELECT term_id, meta_key, meta_value FROM ibz_termmeta WHERE term_id IN (i, i) ORDER BY meta_id ASC

    SELECT t., tt., tr.object_id FROM ibz_terms AS t INNER JOIN ibz_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN ibz_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (s, s, s, s, s) AND tr.object_id IN (ilonglist) ORDER BY t.name ASC

    SELECT t., tt., tr.object_id FROM ibz_terms AS t INNER JOIN ibz_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN ibz_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (s, s, s, s, s) AND tr.object_id IN (ilist) ORDER BY t.name ASC

    SELECT t., tt., tr.object_id FROM ibz_terms AS t INNER JOIN ibz_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN ibz_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (s, s, s, s, s) AND tr.object_id IN (i, i) ORDER BY t.name ASC

    SELECT t., tt., tr.object_id FROM ibz_terms AS t INNER JOIN ibz_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN ibz_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (s, s, s, s, s) AND tr.object_id IN (i) ORDER BY t.name ASC

    SELECT t., tt. FROM ibz_terms AS t INNER JOIN ibz_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN ibz_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (s) AND tr.object_id IN (i) ORDER BY t.name ASC

    3 replies  •  2023-05-01 10:35:30 +08:00
    hefish
        1
    hefish  
       Apr 29, 2023
    照着 sql 把 where 部分的字段盲加一下,再不行把 ORDER by 字段盲加一下,再不行把 ON 字段的盲加一下。。。
    nvhanzhi
        2
    nvhanzhi  
    OP
       Apr 30, 2023
    @hefish 大佬,请帮我写一个做个例子,我完全不懂这个啊,谢谢啦
    RainCats
        3
    RainCats  
       May 1, 2023
    @nvhanzhi 自己去搜一下 MySQL 的建索引语法,或者借助图形化工具操作一下。。。别啥都等着别人喂给你吃
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2425 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:52 · PVG 14:52 · LAX 23:52 · JFK 02:52
    ♥ Do have faith in what you're doing.