Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql索引优化 #3

Open
merlinpanda opened this issue May 10, 2022 · 1 comment
Open

Mysql索引优化 #3

merlinpanda opened this issue May 10, 2022 · 1 comment

Comments

@merlinpanda
Copy link
Owner

索引分类

单值索引

CREATE INDEX index_name ON Table(field)

复合索引

CREATE INDEX idx_ABC ON TableName(a,b,c)

唯一索引

CREATE UNIQUE INDEX idx_d ON TableName(d)

索引结构

  • B树
  • 哈希 Hash
  • 全文索引
  • R树索引
@merlinpanda
Copy link
Owner Author

避免索引失效

  1. 全值索引:比如索引中有a、b、c三个字段,查询时WHERE a = 1 AND b = 2 AND c=3,即索引中的字段全用到

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant