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

推荐订阅源

GbyAI
GbyAI
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
S
Securelist
The Hacker News
The Hacker News
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
AI
AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
博客园 - 司徒正美
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest
Engineering at Meta
Engineering at Meta
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
U
Unit 42
V
V2EX
V2EX - 技术
V2EX - 技术
L
LINUX DO - 最新话题
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
Recorded Future
Recorded Future
P
Privacy & Cybersecurity Law Blog
美团技术团队
小众软件
小众软件
F
Fortinet All Blogs

博客园 - 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几秒