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

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos 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 可以提高一个数量级的查询速度;