随笔分类 - SQL Server
SQL Server2005&2008/MySQL/Service Broker
SQL Server中奇妙的NULL
摘要:http://www.cnblogs.com/changbluesky/archive/2010/05/07/1729519.htmlps.懒得写,懒得总结,copy一个总结不错的,不过还有一些没说到,总之,翻过几次错遇到null都要多考虑多测试相信大家在写SQL时都会有遇到NULL的经历吧,在一个table插入NULL,与NULL作比较等等.1.NULL意思为缺失的值(missing value...
阅读全文
sql server apply与 join等的区别
摘要:cross apply和outer apply和join很相似都是主要在做m*n笛卡尔集,比较显著特征是没有用到Join的ON连接了想想也比较合理,apply应用场景应该是满足join的约束,主要应该是例如返回表变量的函数,貌似还是没区分清楚,举个例子,返回一个customer最近的三个订单或者返回所有类别最热的5个产品这里top N操作如果用JOIN来搞就不好搞了 哈哈 不过也不是不可以搞 用r...
阅读全文
老是在select中丢掉了NOLOCK有啥后果???deadlock ooo
摘要:不使用NOLOCK和READPAST,在Select操作时候则有可能报错误:事务(进程ID**)与另一个进程被死锁在锁资源上,并且已被选作死锁牺牲品。
阅读全文
scope_identity(), @@IDENTITY, IDENT_CURRENT()区别
摘要:这涉及到会话@@SPID和作用域(sp or view等):1.scope_identity():当前作用域所有表最后的标识值2.@@identity:当前session所有表所有表最后的标识值3. IDENT_CURRENT():返回某个表所有session所有作用域的最后的标识值上面是我的话,下面是msdn的话:IDENT_CURRENT 返回为任何会话和任何作用域中的特定表最后生成的标识值。...
阅读全文
Introduction to SQL SQL Server Indexes [A good reference]
摘要:Relational databases like SQLServeruse indexes to find data quickly when a query is processed. Creating and removing indexes from a database schema will rarely result in changes to an application's co...
阅读全文
Eliminate the Use of Temporary Tables For HUGE Performance Gains
摘要:Eliminate the Use of Temporary Tables For HUGE Performance GainsBy :Justin GuntherMay 30, 2002As queries become more complex, temporary tables are used more and more. While temporary table may sometim...
阅读全文
Using NOLOCK and READPAST table hints in SQL Server
摘要:Takeaway:Table locking hints provide developers much tighter control of their transactions. Look at the benefits and disadvantages of using the NOLOCK and READPAST table hints in SQL Server.When data ...
阅读全文
在sqlserver 中with(nolock)详解 [收藏自 蝈蝈俊]
摘要:在sqlserver 中with(nolock)详解所有Select加 With (NoLock)解决阻塞死锁在查询语句中使用NOLOCK和READPAST处理一个数据库死锁的异常时候,其中一个建议就是使用NOLOCK或者READPAST。有关NOLOCK和READPAST的一些技术知识点:对于非银行等严格要求事务的行业,搜索记录中出现或者不出现某条记录,都是在可容忍范围内,所以碰到死锁,应该首先...
阅读全文
SELECT TOP n or SELECT TOP Random n Rows From a Table For Each Category or Group
摘要:SQL - SELECT TOP n or SELECT TOP Random n Rows From a Table For Each Category or GroupYou may need asql querythat willselect top n recordsorrandom n recordsfor each categoryin a table. Thet-sql queryt...
阅读全文
一个数据库问题--寻找T1表中keycol列缺少的最小正整数
摘要:INSERT INTO dbo.T1(keycol, datacol) VALUES(4, 'b');INSERT INTO dbo.T1(keycol, datacol) VALUES(6, 'c');INSERT INTO dbo.T1(keycol, datacol) VALUES(7, 'd');--looking for the minimum missing integer for d...
阅读全文
SSB 1
摘要:DialogConversationsIn most messaging systems, messages are the basic unit ofcommunication. Each message is an isolated entity, and it's up to theapplication logic to keep track of sent and received me...
阅读全文
mysql中length函数和char_length的区别
摘要:length: 是计算字段的长度一个汉字是算三个字符,一个数字或字母算一个字符 char_length:不管汉字还是数字或者是字母都算是一个字符
阅读全文
Scaling MySQL
摘要:一、两种scaling方式 zz from:http://hideto.javaeye.com/blog/133138 1,Vertical partitioning,生成的segments称为partitions 2,Horizontal federation,生成的segments称为shards 二、Storage engines 1,MyISAM IBM开发的ISAM(I...
阅读全文
怎么提高Mysql执行sql导入的速度
摘要:1、如果mysql的data数据很少,内存足够大,可以把data防止到内存盘中。 linux如下设置内存盘: mount -t ramfs none /ram 默认使用内存一半 如果内存不够大,系统有多个硬盘,则把mysql应用程序和data目录分开到不同硬盘上。 2、mysql的表设置为myiasm,比同等条件下的innodb能快20倍以上 3、导入完成以后才创建数据库索引 4、导入完成...
阅读全文
浙公网安备 33010602011771号