高性能MySQL笔记-第4章Optimizing Schema and Data Types
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了高性能MySQL笔记-第4章Optimizing Schema and Data Types,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1631字,纯文字阅读大概需要3分钟。
内容图文
? Try to avoid extremes in your design, such as a schema that will force enormously complex queries, or tables with oodles and oodles of columns. (An oodle is somewhere between a scad and a gazillion.)
? Use small, simple, appropriate data types, and avoid NULL unless it’s actually the right way to model your data’s reality.
? Try to use the same data types to store similar or related values, especially if they’ll be used in a join condition.
? Watch out for variable-length strings, which might cause pessimistic full-length memory allocation for temporary tables and sorting.
? Try to use integers for identifiers if you can.
? Avoid the legacy MySQL-isms such as specifying precisions for floating-point numbers or display widths for integers.
? Be careful with ENUM and SET . They’re handy, but they can be abused, and they’re tricky sometimes. BIT is best avoided.
Normalization is good, but denormalization (duplication of data, in most cases) is sometimes actually necessary and beneficial. We’ll see more examples of that in the next chapter. And precomputing, caching, or generating summary tables can also be a big win. Justin Swanhart’s Flexviews tool can help maintain summary tables.Finally, ALTER TABLE can be painful because in most cases, it locks and rebuilds the whole table. We showed a number of workarounds for specific cases; for the general case, you’ll have to use other techniques, such as performing the ALTER on a replica and
then promoting it to master.
高性能MySQL笔记-第4章Optimizing Schema and Data Types
标签:
本文系统来源:http://www.cnblogs.com/shamgod/p/5380356.html
内容总结
以上是互联网集市为您收集整理的高性能MySQL笔记-第4章Optimizing Schema and Data Types全部内容,希望文章能够帮你解决高性能MySQL笔记-第4章Optimizing Schema and Data Types所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。