| route-pattern | /:user_id/:repository/blob/*name(/*path) |
| route-controller | blob |
| route-action | show |
| fetch-nonce | v2:949764bb-1cf0-e33b-0169-5d04abca9c59 |
| current-catalog-service-hash | f3abb0cc802f3d7b95fc8762b94bdcb13bf39634c40c357301c4aa1d67a256fb |
| request-id | D324:24384D:3EDC305:53BBD24:6A65902D |
| html-safe-nonce | 02a5d13f3c3a9d24a353cffec8ca533a690ae85580045aae5d4a27c08256e045 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzI0OjI0Mzg0RDozRURDMzA1OjUzQkJEMjQ6NkE2NTkwMkQiLCJ2aXNpdG9yX2lkIjoiMzE3OTY1MDEwMDE2NTQ0NzcyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 434ed76bfd63d88f98ffae5192679b3f8d60700d6715b44ae6945695615c070c |
| hovercard-subject-tag | repository:193424681 |
| github-keyboard-shortcuts | repository,source-code,file-tree,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///blob/show |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md |
| twitter:image | https://opengraph.githubassets.com/e700c271233efa9228bf02b3982f816f2eb289435fe5b447c47c7ea71a32d5f9/MYLi-233/JavaGuide |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e700c271233efa9228bf02b3982f816f2eb289435fe5b447c47c7ea71a32d5f9/MYLi-233/JavaGuide |
| og:image:alt | 【Java学习+面试指南】 一份涵盖大部分Java程序员所需要掌握的核心知识。. Contribute to MYLi-233/JavaGuide development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 52c76df668885aaff23b50bdca1fa1ea44ac9c1553e888ebc70ff1e4daa4625b |
| turbo-cache-control | no-cache |
| go-import | github.com/MYLi-233/JavaGuide git https://github.com/MYLi-233/JavaGuide.git |
| octolytics-dimension-user_id | 45924436 |
| octolytics-dimension-user_login | MYLi-233 |
| octolytics-dimension-repository_id | 193424681 |
| octolytics-dimension-repository_nwo | MYLi-233/JavaGuide |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 132464395 |
| octolytics-dimension-repository_parent_nwo | Snailclimb/JavaGuide |
| octolytics-dimension-repository_network_root_id | 132464395 |
| octolytics-dimension-repository_network_root_nwo | Snailclimb/JavaGuide |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 309153364422b3c499922d1a2a6404910a58ed8e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| Skip to content | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#start-of-content |
|
| https://github.com/ |
|
Sign in
| https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FMYLi-233%2FJavaGuide%2Fblob%2Fmaster%2Fdocs%2Fdatabase%2FMySQL%25E9%25AB%2598%25E6%2580%25A7%25E8%2583%25BD%25E4%25BC%2598%25E5%258C%2596%25E8%25A7%2584%25E8%258C%2583%25E5%25BB%25BA%25E8%25AE%25AE.md |
| GitHub CopilotWrite better code with AI | https://github.com/features/copilot |
| GitHub Copilot appDirect agents from issue to merge | https://github.com/features/ai/github-app |
| MCP RegistryNewIntegrate external tools | https://github.com/mcp |
| ActionsAutomate any workflow | https://github.com/features/actions |
| CodespacesInstant dev environments | https://github.com/features/codespaces |
| IssuesPlan and track work | https://github.com/features/issues |
| Code ReviewManage code changes | https://github.com/features/code-review |
| Code QualityEnforce quality at merge | https://github.com/features/code-quality |
| GitHub Advanced SecurityFind and fix vulnerabilities | https://github.com/security/advanced-security |
| Code securitySecure your code as you build | https://github.com/security/advanced-security/code-security |
| Secret protectionStop leaks before they start | https://github.com/security/advanced-security/secret-protection |
| Why GitHub | https://github.com/why-github |
| Documentation | https://docs.github.com |
| Blog | https://github.blog |
| Changelog | https://github.blog/changelog |
| Marketplace | https://github.com/marketplace |
| View all features | https://github.com/features |
| Enterprises | https://github.com/enterprise |
| Small and medium teams | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| App Modernization | https://github.com/solutions/use-case/app-modernization |
| DevSecOps | https://github.com/solutions/use-case/devsecops |
| DevOps | https://github.com/solutions/use-case/devops |
| CI/CD | https://github.com/solutions/use-case/ci-cd |
| View all use cases | https://github.com/solutions/use-case |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| View all industries | https://github.com/solutions/industry |
| View all solutions | https://github.com/solutions |
| AI | https://github.com/resources/articles?topic=ai |
| Software Development | https://github.com/resources/articles?topic=software-development |
| DevOps | https://github.com/resources/articles?topic=devops |
| Security | https://github.com/resources/articles?topic=security |
| View all topics | https://github.com/resources/articles |
| Customer stories | https://github.com/customer-stories |
| Events & webinars | https://github.com/resources/events |
| Ebooks & reports | https://github.com/resources/whitepapers |
| Business insights | https://github.com/solutions/executive-insights |
| GitHub Skills | https://skills.github.com |
| Documentation | https://docs.github.com |
| Customer support | https://support.github.com |
| Community forum | https://github.com/orgs/community/discussions |
| Trust center | https://github.com/trust-center |
| Partners | https://github.com/partners |
| View all resources | https://github.com/resources |
| GitHub SponsorsFund open source developers | https://github.com/open-source/sponsors |
| Security Lab | https://securitylab.github.com |
| Maintainer Community | https://maintainers.github.com |
| Accelerator | https://github.com/open-source/accelerator |
| GitHub Stars | https://stars.github.com |
| Archive Program | https://archiveprogram.github.com |
| Topics | https://github.com/topics |
| Trending | https://github.com/trending |
| Collections | https://github.com/collections |
| Enterprise platformAI-powered developer platform | https://github.com/enterprise |
| GitHub Advanced SecurityEnterprise-grade security features | https://github.com/security/advanced-security |
| Copilot for BusinessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/enterprise/premium-support |
| Pricing | https://github.com/pricing |
| Search syntax tips | https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax |
| documentation | https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax |
|
Sign in
| https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FMYLi-233%2FJavaGuide%2Fblob%2Fmaster%2Fdocs%2Fdatabase%2FMySQL%25E9%25AB%2598%25E6%2580%25A7%25E8%2583%25BD%25E4%25BC%2598%25E5%258C%2596%25E8%25A7%2584%25E8%258C%2583%25E5%25BB%25BA%25E8%25AE%25AE.md |
|
Sign up
| https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fblob%2Fshow&source=header-repo&source_repo=MYLi-233%2FJavaGuide |
| Reload | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md |
| Reload | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md |
| Reload | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md |
|
MYLi-233
| https://github.com/MYLi-233 |
| JavaGuide | https://github.com/MYLi-233/JavaGuide |
| Snailclimb/JavaGuide | https://github.com/Snailclimb/JavaGuide |
|
Notifications
| https://github.com/login?return_to=%2FMYLi-233%2FJavaGuide |
|
Fork
0
| https://github.com/login?return_to=%2FMYLi-233%2FJavaGuide |
|
Star
0
| https://github.com/login?return_to=%2FMYLi-233%2FJavaGuide |
|
Code
| https://github.com/MYLi-233/JavaGuide |
|
Pull requests
0
| https://github.com/MYLi-233/JavaGuide/pulls |
|
Actions
| https://github.com/MYLi-233/JavaGuide/actions |
|
Projects
| https://github.com/MYLi-233/JavaGuide/projects |
|
Security and quality
0
| https://github.com/MYLi-233/JavaGuide/security |
|
Insights
| https://github.com/MYLi-233/JavaGuide/pulse |
|
Code
| https://github.com/MYLi-233/JavaGuide |
|
Pull requests
| https://github.com/MYLi-233/JavaGuide/pulls |
|
Actions
| https://github.com/MYLi-233/JavaGuide/actions |
|
Projects
| https://github.com/MYLi-233/JavaGuide/projects |
|
Security and quality
| https://github.com/MYLi-233/JavaGuide/security |
|
Insights
| https://github.com/MYLi-233/JavaGuide/pulse |
| https://github.com/MYLi-233/JavaGuide |
| JavaGuide | https://github.com/MYLi-233/JavaGuide/tree/master |
| docs | https://github.com/MYLi-233/JavaGuide/tree/master/docs |
| database | https://github.com/MYLi-233/JavaGuide/tree/master/docs/database |
| History | https://github.com/MYLi-233/JavaGuide/commits/master/docs/database/MySQL%E9%AB%98%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E8%A7%84%E8%8C%83%E5%BB%BA%E8%AE%AE.md |
| https://github.com/MYLi-233/JavaGuide/commits/master/docs/database/MySQL%E9%AB%98%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E8%A7%84%E8%8C%83%E5%BB%BA%E8%AE%AE.md |
| JavaGuide | https://github.com/MYLi-233/JavaGuide/tree/master |
| docs | https://github.com/MYLi-233/JavaGuide/tree/master/docs |
| database | https://github.com/MYLi-233/JavaGuide/tree/master/docs/database |
| Raw | https://github.com/MYLi-233/JavaGuide/raw/refs/heads/master/docs/database/MySQL%E9%AB%98%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E8%A7%84%E8%8C%83%E5%BB%BA%E8%AE%AE.md |
| https://www.cnblogs.com/huchong/p/10219318.html | https://www.cnblogs.com/huchong/p/10219318.html |
| 数据库命令规范 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#%E6%95%B0%E6%8D%AE%E5%BA%93%E5%91%BD%E4%BB%A4%E8%A7%84%E8%8C%83 |
| 数据库基本设计规范 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#%E6%95%B0%E6%8D%AE%E5%BA%93%E5%9F%BA%E6%9C%AC%E8%AE%BE%E8%AE%A1%E8%A7%84%E8%8C%83 |
| 1. 所有表必须使用 Innodb 存储引擎 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-%E6%89%80%E6%9C%89%E8%A1%A8%E5%BF%85%E9%A1%BB%E4%BD%BF%E7%94%A8-innodb-%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E |
| 2. 数据库和表的字符集统一使用 UTF8 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-%E6%95%B0%E6%8D%AE%E5%BA%93%E5%92%8C%E8%A1%A8%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E7%BB%9F%E4%B8%80%E4%BD%BF%E7%94%A8-utf8 |
| 3. 所有表和字段都需要添加注释 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-%E6%89%80%E6%9C%89%E8%A1%A8%E5%92%8C%E5%AD%97%E6%AE%B5%E9%83%BD%E9%9C%80%E8%A6%81%E6%B7%BB%E5%8A%A0%E6%B3%A8%E9%87%8A |
| 4. 尽量控制单表数据量的大小,建议控制在 500 万以内。 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-%E5%B0%BD%E9%87%8F%E6%8E%A7%E5%88%B6%E5%8D%95%E8%A1%A8%E6%95%B0%E6%8D%AE%E9%87%8F%E7%9A%84%E5%A4%A7%E5%B0%8F%E5%BB%BA%E8%AE%AE%E6%8E%A7%E5%88%B6%E5%9C%A8-500-%E4%B8%87%E4%BB%A5%E5%86%85 |
| 5. 谨慎使用 MySQL 分区表 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5-%E8%B0%A8%E6%85%8E%E4%BD%BF%E7%94%A8-mysql-%E5%88%86%E5%8C%BA%E8%A1%A8 |
| 6.尽量做到冷热数据分离,减小表的宽度 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6%E5%B0%BD%E9%87%8F%E5%81%9A%E5%88%B0%E5%86%B7%E7%83%AD%E6%95%B0%E6%8D%AE%E5%88%86%E7%A6%BB%E5%87%8F%E5%B0%8F%E8%A1%A8%E7%9A%84%E5%AE%BD%E5%BA%A6 |
| 7. 禁止在表中建立预留字段 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#7-%E7%A6%81%E6%AD%A2%E5%9C%A8%E8%A1%A8%E4%B8%AD%E5%BB%BA%E7%AB%8B%E9%A2%84%E7%95%99%E5%AD%97%E6%AE%B5 |
| 8. 禁止在数据库中存储图片,文件等大的二进制数据 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#8-%E7%A6%81%E6%AD%A2%E5%9C%A8%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%AD%E5%AD%98%E5%82%A8%E5%9B%BE%E7%89%87%E6%96%87%E4%BB%B6%E7%AD%89%E5%A4%A7%E7%9A%84%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%95%B0%E6%8D%AE |
| 9. 禁止在线上做数据库压力测试 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#9-%E7%A6%81%E6%AD%A2%E5%9C%A8%E7%BA%BF%E4%B8%8A%E5%81%9A%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%8B%E5%8A%9B%E6%B5%8B%E8%AF%95 |
| 10. 禁止从开发环境,测试环境直接连接生成环境数据库 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#10-%E7%A6%81%E6%AD%A2%E4%BB%8E%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83%E7%9B%B4%E6%8E%A5%E8%BF%9E%E6%8E%A5%E7%94%9F%E6%88%90%E7%8E%AF%E5%A2%83%E6%95%B0%E6%8D%AE%E5%BA%93 |
| 数据库字段设计规范 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AD%97%E6%AE%B5%E8%AE%BE%E8%AE%A1%E8%A7%84%E8%8C%83 |
| 1. 优先选择符合存储需要的最小的数据类型 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-%E4%BC%98%E5%85%88%E9%80%89%E6%8B%A9%E7%AC%A6%E5%90%88%E5%AD%98%E5%82%A8%E9%9C%80%E8%A6%81%E7%9A%84%E6%9C%80%E5%B0%8F%E7%9A%84%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B |
| 2. 避免使用 TEXT,BLOB 数据类型,最常见的 TEXT 类型可以存储 64k 的数据 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-%E9%81%BF%E5%85%8D%E4%BD%BF%E7%94%A8-textblob-%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E6%9C%80%E5%B8%B8%E8%A7%81%E7%9A%84-text-%E7%B1%BB%E5%9E%8B%E5%8F%AF%E4%BB%A5%E5%AD%98%E5%82%A8-64k-%E7%9A%84%E6%95%B0%E6%8D%AE |
| 3. 避免使用 ENUM 类型 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-%E9%81%BF%E5%85%8D%E4%BD%BF%E7%94%A8-enum-%E7%B1%BB%E5%9E%8B |
| 4. 尽可能把所有列定义为 NOT NULL | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-%E5%B0%BD%E5%8F%AF%E8%83%BD%E6%8A%8A%E6%89%80%E6%9C%89%E5%88%97%E5%AE%9A%E4%B9%89%E4%B8%BA-not-null |
| 5. 使用 TIMESTAMP(4 个字节) 或 DATETIME 类型 (8 个字节) 存储时间 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5-%E4%BD%BF%E7%94%A8-timestamp4-%E4%B8%AA%E5%AD%97%E8%8A%82-%E6%88%96-datetime-%E7%B1%BB%E5%9E%8B-8-%E4%B8%AA%E5%AD%97%E8%8A%82-%E5%AD%98%E5%82%A8%E6%97%B6%E9%97%B4 |
| 6. 同财务相关的金额类数据必须使用 decimal 类型 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6-%E5%90%8C%E8%B4%A2%E5%8A%A1%E7%9B%B8%E5%85%B3%E7%9A%84%E9%87%91%E9%A2%9D%E7%B1%BB%E6%95%B0%E6%8D%AE%E5%BF%85%E9%A1%BB%E4%BD%BF%E7%94%A8-decimal-%E7%B1%BB%E5%9E%8B |
| 索引设计规范 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#%E7%B4%A2%E5%BC%95%E8%AE%BE%E8%AE%A1%E8%A7%84%E8%8C%83 |
| 1. 限制每张表上的索引数量,建议单张表索引不超过 5 个 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-%E9%99%90%E5%88%B6%E6%AF%8F%E5%BC%A0%E8%A1%A8%E4%B8%8A%E7%9A%84%E7%B4%A2%E5%BC%95%E6%95%B0%E9%87%8F%E5%BB%BA%E8%AE%AE%E5%8D%95%E5%BC%A0%E8%A1%A8%E7%B4%A2%E5%BC%95%E4%B8%8D%E8%B6%85%E8%BF%87-5-%E4%B8%AA |
| 2. 禁止给表中的每一列都建立单独的索引 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-%E7%A6%81%E6%AD%A2%E7%BB%99%E8%A1%A8%E4%B8%AD%E7%9A%84%E6%AF%8F%E4%B8%80%E5%88%97%E9%83%BD%E5%BB%BA%E7%AB%8B%E5%8D%95%E7%8B%AC%E7%9A%84%E7%B4%A2%E5%BC%95 |
| 3. 每个 Innodb 表必须有个主键 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-%E6%AF%8F%E4%B8%AA-innodb-%E8%A1%A8%E5%BF%85%E9%A1%BB%E6%9C%89%E4%B8%AA%E4%B8%BB%E9%94%AE |
| 4. 常见索引列建议 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-%E5%B8%B8%E8%A7%81%E7%B4%A2%E5%BC%95%E5%88%97%E5%BB%BA%E8%AE%AE |
| 5.如何选择索引列的顺序 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5%E5%A6%82%E4%BD%95%E9%80%89%E6%8B%A9%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84%E9%A1%BA%E5%BA%8F |
| 6. 避免建立冗余索引和重复索引(增加了查询优化器生成执行计划的时间) | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6-%E9%81%BF%E5%85%8D%E5%BB%BA%E7%AB%8B%E5%86%97%E4%BD%99%E7%B4%A2%E5%BC%95%E5%92%8C%E9%87%8D%E5%A4%8D%E7%B4%A2%E5%BC%95%E5%A2%9E%E5%8A%A0%E4%BA%86%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E7%94%9F%E6%88%90%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84%E6%97%B6%E9%97%B4 |
| 7. 对于频繁的查询优先考虑使用覆盖索引 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#7-%E5%AF%B9%E4%BA%8E%E9%A2%91%E7%B9%81%E7%9A%84%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%85%88%E8%80%83%E8%99%91%E4%BD%BF%E7%94%A8%E8%A6%86%E7%9B%96%E7%B4%A2%E5%BC%95 |
| 8.索引 SET 规范 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#8%E7%B4%A2%E5%BC%95-set-%E8%A7%84%E8%8C%83 |
| 数据库 SQL 开发规范 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#%E6%95%B0%E6%8D%AE%E5%BA%93-sql-%E5%BC%80%E5%8F%91%E8%A7%84%E8%8C%83 |
| 1. 建议使用预编译语句进行数据库操作 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-%E5%BB%BA%E8%AE%AE%E4%BD%BF%E7%94%A8%E9%A2%84%E7%BC%96%E8%AF%91%E8%AF%AD%E5%8F%A5%E8%BF%9B%E8%A1%8C%E6%95%B0%E6%8D%AE%E5%BA%93%E6%93%8D%E4%BD%9C |
| 2. 避免数据类型的隐式转换 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-%E9%81%BF%E5%85%8D%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%9A%90%E5%BC%8F%E8%BD%AC%E6%8D%A2 |
| 3. 充分利用表上已经存在的索引 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-%E5%85%85%E5%88%86%E5%88%A9%E7%94%A8%E8%A1%A8%E4%B8%8A%E5%B7%B2%E7%BB%8F%E5%AD%98%E5%9C%A8%E7%9A%84%E7%B4%A2%E5%BC%95 |
| 4. 数据库设计时,应该要对以后扩展进行考虑 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1%E6%97%B6%E5%BA%94%E8%AF%A5%E8%A6%81%E5%AF%B9%E4%BB%A5%E5%90%8E%E6%89%A9%E5%B1%95%E8%BF%9B%E8%A1%8C%E8%80%83%E8%99%91 |
| 5. 程序连接不同的数据库使用不同的账号,进制跨库查询 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5-%E7%A8%8B%E5%BA%8F%E8%BF%9E%E6%8E%A5%E4%B8%8D%E5%90%8C%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%9A%84%E8%B4%A6%E5%8F%B7%E8%BF%9B%E5%88%B6%E8%B7%A8%E5%BA%93%E6%9F%A5%E8%AF%A2 |
| 6. 禁止使用 SELECT * 必须使用 SELECT <字段列表> 查询 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6-%E7%A6%81%E6%AD%A2%E4%BD%BF%E7%94%A8-select--%E5%BF%85%E9%A1%BB%E4%BD%BF%E7%94%A8-select-%E5%AD%97%E6%AE%B5%E5%88%97%E8%A1%A8-%E6%9F%A5%E8%AF%A2 |
| 7. 禁止使用不含字段列表的 INSERT 语句 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#7-%E7%A6%81%E6%AD%A2%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%AB%E5%AD%97%E6%AE%B5%E5%88%97%E8%A1%A8%E7%9A%84-insert-%E8%AF%AD%E5%8F%A5 |
| 8. 避免使用子查询,可以把子查询优化为 join 操作 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#8-%E9%81%BF%E5%85%8D%E4%BD%BF%E7%94%A8%E5%AD%90%E6%9F%A5%E8%AF%A2%E5%8F%AF%E4%BB%A5%E6%8A%8A%E5%AD%90%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E4%B8%BA-join-%E6%93%8D%E4%BD%9C |
| 9. 避免使用 JOIN 关联太多的表 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#9-%E9%81%BF%E5%85%8D%E4%BD%BF%E7%94%A8-join-%E5%85%B3%E8%81%94%E5%A4%AA%E5%A4%9A%E7%9A%84%E8%A1%A8 |
| 10. 减少同数据库的交互次数 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#10-%E5%87%8F%E5%B0%91%E5%90%8C%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E4%BA%A4%E4%BA%92%E6%AC%A1%E6%95%B0 |
| 11. 对应同一列进行 or 判断时,使用 in 代替 or | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#11-%E5%AF%B9%E5%BA%94%E5%90%8C%E4%B8%80%E5%88%97%E8%BF%9B%E8%A1%8C-or-%E5%88%A4%E6%96%AD%E6%97%B6%E4%BD%BF%E7%94%A8-in-%E4%BB%A3%E6%9B%BF-or |
| 12. 禁止使用 order by rand() 进行随机排序 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#12-%E7%A6%81%E6%AD%A2%E4%BD%BF%E7%94%A8-order-by-rand-%E8%BF%9B%E8%A1%8C%E9%9A%8F%E6%9C%BA%E6%8E%92%E5%BA%8F |
| 13. WHERE 从句中禁止对列进行函数转换和计算 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#13-where-%E4%BB%8E%E5%8F%A5%E4%B8%AD%E7%A6%81%E6%AD%A2%E5%AF%B9%E5%88%97%E8%BF%9B%E8%A1%8C%E5%87%BD%E6%95%B0%E8%BD%AC%E6%8D%A2%E5%92%8C%E8%AE%A1%E7%AE%97 |
| 14. 在明显不会有重复值时使用 UNION ALL 而不是 UNION | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#14-%E5%9C%A8%E6%98%8E%E6%98%BE%E4%B8%8D%E4%BC%9A%E6%9C%89%E9%87%8D%E5%A4%8D%E5%80%BC%E6%97%B6%E4%BD%BF%E7%94%A8-union-all-%E8%80%8C%E4%B8%8D%E6%98%AF-union |
| 15. 拆分复杂的大 SQL 为多个小 SQL | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#15-%E6%8B%86%E5%88%86%E5%A4%8D%E6%9D%82%E7%9A%84%E5%A4%A7-sql-%E4%B8%BA%E5%A4%9A%E4%B8%AA%E5%B0%8F-sql |
| 数据库操作行为规范 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#%E6%95%B0%E6%8D%AE%E5%BA%93%E6%93%8D%E4%BD%9C%E8%A1%8C%E4%B8%BA%E8%A7%84%E8%8C%83 |
| 1. 超 100 万行的批量写 (UPDATE,DELETE,INSERT) 操作,要分批多次进行操作 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-%E8%B6%85-100-%E4%B8%87%E8%A1%8C%E7%9A%84%E6%89%B9%E9%87%8F%E5%86%99-updatedeleteinsert-%E6%93%8D%E4%BD%9C%E8%A6%81%E5%88%86%E6%89%B9%E5%A4%9A%E6%AC%A1%E8%BF%9B%E8%A1%8C%E6%93%8D%E4%BD%9C |
| 2. 对于大表使用 pt-online-schema-change 修改表结构 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-%E5%AF%B9%E4%BA%8E%E5%A4%A7%E8%A1%A8%E4%BD%BF%E7%94%A8-pt-online-schema-change-%E4%BF%AE%E6%94%B9%E8%A1%A8%E7%BB%93%E6%9E%84 |
| 3. 禁止为程序使用的账号赋予 super 权限 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-%E7%A6%81%E6%AD%A2%E4%B8%BA%E7%A8%8B%E5%BA%8F%E4%BD%BF%E7%94%A8%E7%9A%84%E8%B4%A6%E5%8F%B7%E8%B5%8B%E4%BA%88-super-%E6%9D%83%E9%99%90 |
| 4. 对于程序连接数据库账号,遵循权限最小原则 | https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-%E5%AF%B9%E4%BA%8E%E7%A8%8B%E5%BA%8F%E8%BF%9E%E6%8E%A5%E6%95%B0%E6%8D%AE%E5%BA%93%E8%B4%A6%E5%8F%B7%E9%81%B5%E5%BE%AA%E6%9D%83%E9%99%90%E6%9C%80%E5%B0%8F%E5%8E%9F%E5%88%99 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#数据库命令规范 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#数据库基本设计规范 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-所有表必须使用-innodb-存储引擎 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-数据库和表的字符集统一使用-utf8 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-所有表和字段都需要添加注释 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-尽量控制单表数据量的大小建议控制在-500-万以内 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5-谨慎使用-mysql-分区表 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6尽量做到冷热数据分离减小表的宽度 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#7-禁止在表中建立预留字段 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#8-禁止在数据库中存储图片文件等大的二进制数据 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#9-禁止在线上做数据库压力测试 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#10-禁止从开发环境测试环境直接连接生产环境数据库 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#数据库字段设计规范 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-优先选择符合存储需要的最小的数据类型 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-避免使用-textblob-数据类型最常见的-text-类型可以存储-64k-的数据 |
| MySQL | http://mp.weixin.qq.com/s?__biz=MzI4Njc5NjM1NQ==&mid=2247487885&idx=1&sn=65b1bf5f7d4505502620179669a9c2df&chksm=ebd62ea1dca1a7b7bf884bcd9d538d78ba064ee03c09436ca8e57873b1d98a55afd6d7884cfc&scene=21#wechat_redirect |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-避免使用-enum-类型 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-尽可能把所有列定义为-not-null |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5-使用-timestamp4-个字节-或-datetime-类型-8-个字节-存储时间 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6-同财务相关的金额类数据必须使用-decimal-类型 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#索引设计规范 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-限制每张表上的索引数量建议单张表索引不超过-5-个 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-禁止给表中的每一列都建立单独的索引 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-每个-innodb-表必须有个主键 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-常见索引列建议 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5如何选择索引列的顺序 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6-避免建立冗余索引和重复索引增加了查询优化器生成执行计划的时间 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#7-对于频繁的查询优先考虑使用覆盖索引 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#8索引-set-规范 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#数据库-sql-开发规范 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-建议使用预编译语句进行数据库操作 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-避免数据类型的隐式转换 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-充分利用表上已经存在的索引 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-数据库设计时应该要对以后扩展进行考虑 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#5-程序连接不同的数据库使用不同的账号禁止跨库查询 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#6-禁止使用-select--必须使用-select-字段列表-查询 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#7-禁止使用不含字段列表的-insert-语句 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#8-避免使用子查询可以把子查询优化为-join-操作 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#9-避免使用-join-关联太多的表 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#10-减少同数据库的交互次数 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#11-对应同一列进行-or-判断时使用-in-代替-or |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#12-禁止使用-order-by-rand-进行随机排序 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#13-where-从句中禁止对列进行函数转换和计算 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#14-在明显不会有重复值时使用-union-all-而不是-union |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#15-拆分复杂的大-sql-为多个小-sql |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#数据库操作行为规范 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#1-超-100-万行的批量写-updatedeleteinsert-操作要分批多次进行操作 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#2-对于大表使用-pt-online-schema-change-修改表结构 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#3-禁止为程序使用的账号赋予-super-权限 |
| https://github.com/MYLi-233/JavaGuide/blob/master/docs/database/MySQL高性能优化规范建议.md#4-对于程序连接数据库账号遵循权限最小原则 |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |