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

2023-04-29 23:30:16 +08:00
 nvhanzhi

我用插件查出来的,我的 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

1426 次点击
所在节点    MySQL
3 条回复
hefish
2023-04-29 23:38:05 +08:00
照着 sql 把 where 部分的字段盲加一下,再不行把 ORDER by 字段盲加一下,再不行把 ON 字段的盲加一下。。。
nvhanzhi
2023-04-30 01:26:55 +08:00
@hefish 大佬,请帮我写一个做个例子,我完全不懂这个啊,谢谢啦
RainCats
2023-05-01 10:35:30 +08:00
@nvhanzhi 自己去搜一下 MySQL 的建索引语法,或者借助图形化工具操作一下。。。别啥都等着别人喂给你吃

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/936501

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX