易截截图软件、单文件、免安装、纯绿色、仅160KB

sql 2005 强制使用执行计划 T—SQl

select * from tt t inner loop join ss s with(nolock) on s.c=t.c
 
 使用 nested join
select * from tt t inner merge join ss s with(nolock) on s.c=t.c
 
 使用 merge join
 
select * from tt t inner hash join ss s with(nolock) on s.c=t.c
 
使用  hash jion
 
nolock 不允许锁 
 
 
 
 
Microsoft SQL Server sometimes uses hash and merge joins when querying large tables when uncomplicated nested loop joins would result in better performance and less server impact. In many such cases, query times go from many milliseconds to many seconds because hash table joins require that large amounts of data be processed and temporarily stored, and merge joins require sorting and then processing similarly large amounts of data.
This is fine for one-time administrative "fact finding" queries where you don't have or want the indices needed to optimize the query, and you're willing to wait the seconds or minutes it takes to get results.
For day-in-and-day-out application queries, however, you don't want your database engine to be hashing or sorting hundreds of thousands or millions of rows, especially when the end result is only a small number of rows.


相关文档:

SQL 字符串函数

************************************************************
*
 
ASCII
--
->ASCII ( character_expression ) --->返回字符表达式最左端字符的 ASCII 代码值。
*
    
select
 
ascii
(
'
abcdef
'
)
*
 
CHAR
--
->CH ......

关于SQL的左右连接查询

一直以来对于SQL的查询都没怎么在意,今天遇到一个关于左连接查询的问题。
Select  uId ,uName,dpName
from users
left join dpart
on  users.pid=1 where u.pid=dpart.pid
结果是把users所有结果查询出来,而不是pid为1的用户
原来on后面必须放连接条件,其他的条件放在where里面
感谢夏欢提出 ......

SQL SEVER与ORACLE 的sql语句区别

数学函数:
1.绝对值
S:SELECT abs(-1) value
O:SELECT abs(-1) value from dual
2.取整(大)
S:SELECT ceiling(-1.001) value
O:SELECT ceil(-1.001) value from dual
3.取整(小)
S:SELECT floor(-1.001) value
O:SELECT floor(-1.001) value from dual
4.取整(截取)
S:SELECT cast(-1.002 as int) value
O ......

组合索引优化SQL续

昨天我说,用组合索引优化SQL,并不是最优的,这是因为在8亿的表上面有个等价的物化视图,这个物化视图可以代替我在之前在表上面建立的组合索引。
SQL> explain plan for SELECT distinct * from (select
  2   (PROD_9005_GDF_WK_SS_FDIM.PROD_4_NAME),
  3    PROD_9005_GDF_WK ......

深度对比Oracle与SQL Server

一般的公司通常会在他们的信息系统架构中引入多种数据库平台,同时引入三到四种不同的RDBMS解决方案的中大型公司也并不少见,当然这些公司里面的DBA们通常也需要同时拥有管理多种不同平台的技能了。
只在一种平台上展开工作的数据库专家们也通常会期待着在他们的下一份工作中能学到点不一样的东西,那些有勇气的人们则愿意 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号