最近,线上的 ETL 数据归档 SQL 发生了点问题,有一个 UPDATE SQL 跑了两天还没跑出来: update t_order_record set archive_id = '420a7fe7-4767-45e8-a5f5-72280c192faa', update_time = update_time where order_id in (select order_id from t_retailer_order_record force index (idx_archive_id)
1.尽量不要在where中包含子查询; 关于时间的查询,尽量不要写成:where to_char(dif_date,'yyyy-mm-dd')=to_char('2007-07-01′,'yyyy-mm-dd'); 2.在过滤条件中,可以过滤掉最大数量记录的条件必须放在where子句的末尾; FROM 子句中写在最后的表(基础表,driving table)将被最先处理,在FROM子句中包含多个表的情况下,你必须选择记录条数最少的表作为基础表.如果有三个以上的连接查询,那就需要选择交叉表 (in
方法 1. 使用tempdb来提速 create index index_name on table_name (column_list) with(sort_in_tempdb = on); 方法 2. 使用多线程为来提速 create index index_name on table_name (column_list) with(maxdop = 4); maxdop ( max dgree of parallelism)这下记到了吧
首先说明一下需求以及环境 创建Table1以及Table2两张表,并插入一下数据 USE AdventureWorks2012; GO IF OBJECT_ID ('dbo.Table1', 'U') IS NOT NULL DROP TABLE dbo.Table1; GO IF OBJECT_ID ('dbo.Table2', 'U') IS NOT NULL DROP TABLE dbo.Table2; GO CREATE TABLE dbo.Table1 (ColA int NOT NU
关键词:复制,复制总结,复制汇总,复制查阅 1.概念与搭建 Step1:SQL SERVER复制介绍 Step2:SQL Server 复制事务发布 Step3:SQL Server 通过备份文件初始化复制 Step4:SQL Server 跨网段(跨机房)复制 Step5:SQL Server 跨网段(跨机房)FTP复制 Step6:SQL Server 数据变更时间戳(timestamp)在复制中的运用 Step7:SQL Server 多实例下的复制 2.优化与使用 SQL Se
Problem One task that you may need to do as a DBA is to move the system databases from one location to another. The documentation that is found on the Microsoft site is helpful, but the steps are more geared toward moving one database at a time. In