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

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - guoadou

新的开始 《项目管理艺术》读书笔记 —— 决定做什么的常见不良决策一览 《项目管理艺术》读书笔记 —— 项目规划的三种观点 《IF》 - Joseph Rudyard Kipling 论信息系统的架构设计 【转】系统架构设计师考试大纲(2009) nginx error_page 404 用 php header 无法跳转 The Elements of Programming Style 导出MySQL数据库结构的PHP脚本 轻松面试 搞定技术奇才 Cyworld Values & Principles 长的很像Cyworld的QQ [北京][赛我网]HTML高级工程师 - guoadou - 博客园 [招聘] 韩国企业招聘Java .NET 开发人员 utf8_to_unicode in PHP document.body.scrollTop总是零的原因 unicode_to_utf8 in PHP [新闻]Cyworld.com.cn开始公测 hex2bin in PHP
通过创建SCHEMABINDING VIEW提高JOIN的速度
guoadou · 2007-01-29 · via 博客园 - guoadou

朋友的网站速度慢,让我帮忙看下,他用的SQL Server里面 有一个文章表里面有30多万条记录 还有一个用户表里面也差不多17万记录 偏偏当初设计的时候没有冗余字段 很多帖子信息需要JOIN用户表来显示 @_@
还好今天学了一招

CREATE VIEW [dbo].[view_xxx] WITH SCHEMABINDING 
AS 
SELECT Table1.主键, Table1.外键 
FROM Table1, Table2 
WHERE ( Table1.外键 = Table2.主键)

CREATE UNIQUE CLUSTERED INDEX IDX_view_xxx
    
ON [dbo].[view_xxx] (主键, 外键);

ALTER DATABASE dbname 
SET ARITHABORT ON 

这样就给视图创建了一个聚集索引

连表以后COUNT的速度从1.几秒一下子降到0.00几秒