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

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - 最坏是单飞

[转载]启用IIS的Gzip压缩功能 javascript判断IFRAME是否加载完成 - 最坏是单飞 - 博客园 Cookie注入是怎样产生的 判断记录是否存在 exists 和 top 1 要比 count 快 国外网站设计与浏览习惯 从一个错误提示引出SQL中in和or的问题。 CSS中 link与@import的区别 firefox3.0上安装google toolbar的问题 ASP.NET中常用的26个优化性能方法 INSERT 失败,因为下列 SET 选项的设置不正确: 'ARITHABORT' 背英语单词的捷径 提高sql server性能的几种方法 Windows下配置Apache支持PHP windows Server mysql的root密码忘记修复方法 sb.5252.ws恶意注入解决方法 asp调用存储过程返回值为空解决方案 - 最坏是单飞 - 博客园 如何在SQL Sever中建立索引? 解决ASP.NET中Type.GetType方法总返回空的问题 - 最坏是单飞 - 博客园 验证视图状态 MAC 失败
select时尽可能少使用as对性能很有好处
最坏是单飞 · 2008-05-10 · via 博客园 - 最坏是单飞

今天突然突然网站有个页面打开贼慢,基本就开不了了
总是超时。。心说,怎么可能,已经尽量优化了啊。。再说数据量也不大也就20万
心里很不爽,就打开页面去看。。
哇,NND,这页面谁做的?

竟然都是 as as as啊啊啊啊啊啊啊啊啊啊啊啊啊
下面说下select中优化的两个小环节

1.尽量少用或不用as
如:selelct province+city as city from products
这样检索的虽然很方便可以得到数据。。
但是as后性能会大大折扣

本人用一个3万数据的表测试 [content] 字段为ntext型,[companyname]为nvarchar(50)

测试语句select companyname as companyname,[content] as 'content' from companys

执行结果为

4:48
5:00
4:32

而去掉了as后select companyname,[content]  from companys
执行结果为

2:45
2:48
2:40

虽然只是一个简单的测试,但是执行结果可以说明速度的差距