没有查询条件越多就越慢, 或是查询条件越多就越快的说法具体的要看具体应用。 比如tb 50w记录. id idneity 聚集索引 要求:查出最近5条,近三天内 username 含 aa的记录 那么写法是 select top 5... where datediff(dd,datefield,getdate())<=3 and username like '%aa%' order by datefield 说条件越多就越慢的朋友高兴了,确实越多越慢.如果定期对数据做分析,可以知道三天前的数据的id最小都是大于470000的,那么 where id>470000 and datediff(dd,datefield,getdate())<=3 and username like '%aa%' order by datefield 说条件赵多越快的朋友就又高兴了,确实加了这个where id>.. 之后快多了。 但是去掉 and username like .. 会更快说以说,这个不能一概而论
但我建议转oracle是个不错的选择。
我们的服务器用的也是SQL2000 数据已经快200W了 有50多个表
另外有少量的view,trigger等。
使用2臺機子cluster server
操作系統2003
機子配置 Hewlett Packard HP server rx2620 Itanium 2
1.30GHz, 9.98GB of RAM.
Intel Itanium processor familyp.s: 弱弱的想,用來玩游戲會不會很爽?
再大就困难了你这个应该没问题
所以没有绝对的多好还是少好
几个50W的记录sqlserver处理不了,微软还出什么2005?微软的数据库早歇菜了
那是都where and 还是只写一个比较快
那是都where and 还是只写一个比较快
----一个快
对于条件,要尽量的优化sql语句,建立合适的索引,
少用临时表,减少表连接,多用存储过程等等。qq307366759 注明csdn
比如tb 50w记录. id idneity 聚集索引
要求:查出最近5条,近三天内 username 含 aa的记录
那么写法是
select top 5... where datediff(dd,datefield,getdate())<=3 and username like '%aa%' order by datefield
说条件越多就越慢的朋友高兴了,确实越多越慢.如果定期对数据做分析,可以知道三天前的数据的id最小都是大于470000的,那么
where id>470000 and datediff(dd,datefield,getdate())<=3 and username like '%aa%' order by datefield
说条件赵多越快的朋友就又高兴了,确实加了这个where id>.. 之后快多了。
但是去掉 and username like .. 会更快说以说,这个不能一概而论