惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
C
Cisco Blogs
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Scott Helme
Scott Helme
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
L
LINUX DO - 热门话题
I
InfoQ
GbyAI
GbyAI
NISL@THU
NISL@THU
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More
TaoSecurity Blog
TaoSecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
A
About on SuperTechFans
Spread Privacy
Spread Privacy
月光博客
月光博客
W
WeLiveSecurity
AWS News Blog
AWS News Blog
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
Security Latest
Security Latest
人人都是产品经理
人人都是产品经理
PCI Perspectives
PCI Perspectives
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
T
Troy Hunt's Blog
Martin Fowler
Martin Fowler
The Hacker News
The Hacker News
T
Tor Project blog
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
Stack Overflow Blog
Stack Overflow Blog
K
Kaspersky official blog
Cloudbric
Cloudbric
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
D
DataBreaches.Net
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tenable Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - Franky
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog

博客园 - Prolove

android 开源框架推荐 手机游戏玩家来源渠道统计方法 Centos+Nginx+PHP+Mysql 如何调整不良的 IT 管理习惯 URL 重写 mysql 忘记 root 密码 DedeCms 生成性能终极优化策略 Red Hat Enterprise Linux AS release 4 下安装 gcc (转帖) linux 架设 subversion(svn) 版本控制[转载] js firefox3 下 fckeditor 插入超链接失效解决办法 Zend Studio 5.0 5.1 5.5 系列号 注册码 SN 不指定 google 病毒警告提示网站有病毒木马的解除方法 js 判断浏览器类型 iexplore.exe 应用程序错误 该内存不能为"read" 点击 input 框,框内提示消失效果 php 求某时间段的时间戳开始和结尾 通过SSH 解压缩 .tar.gz .gz .zip 文件的方法 PHP: Allowed memory size of 的解决
Mysql 数据库优化的几个办法
Prolove · 2011-05-24 · via 博客园 - Prolove

1、数据库设计方面,这是 DBA 和 Architect 的责任,设计结构良好的数据库,必要的时候,去正规化(英文是这个: denormalize),允许部分数据冗余,避免 JOIN 操作,以提高查询效率;
2、系统架构设计方面,表散列,把海量数据散列到几个不同的表里面.快慢表,快表只留最新数据,慢表是历史存档.集群,主服务器 Read & write,从服务器 read only, 或者 N 台服务器,各机器互为Master( Mysql 貌似对此支持不是很好);
3、1 和 3 超越 PHP Programmer 的要求了,会更好,不会没关系.检查有没有少加索引(必要时候考虑使用联合索引);
4、写高效的 SQL 语句,看看有没有写低效的SQL语句,比如生成笛卡尔积的全连接啊,大量的 Group By 和 order by,没有 limit 等等.必要的时候,把数据库逻辑封装到DBMS端的存储过程里面.缓存查询结果, explain 每一个 SQL 语句;
5、所得皆必须,只从数据库取必需的数据,比如查询某篇文章的评论数, select count(*) ... where article_id = ? 就可以了,不要先 select * ... where article_id = ?然后 msql_num_rows. 只传送必须的 SQL 语句,比如修改文章的时候,如果用户只修改了标题,那就 update ... set title = ? where article_id = ?不要 set content = ?(大文本);
6、必要的时候用不同的存储引擎.比如 InnoDB 可以减少死锁. HEAP 可以提高一个数量级的查询速度;