Tag Info

Hot answers tagged

2

Without query execution plan, my first thoughts are: I. Use datetime variables to remove implicit convertion and use index. DECLARE @day as datetime2(2) = '20141007' DECLARE @dayStart as datetime2(2) = CONCAT(@day,' 00:00:00.000') DECLARE @dayEnd as datetime2(2) = CONCAT(@day,' 23:59:59.999') II. Change EXISTS for INNER JOIN EXISTS (Select * FROM Acks ...


1

The easiest way is to first remove any triggers which direct new rows to the child tables, and then do this for each child table: with t as (delete from child_table_1 returning *) insert into parent_table select * from t; The locking and performance implications may dictate against this method, but it is hard to beat it for simplicity. You might ...


1

You can monitor the number of rows as you perform inserts. This is the script I use, borrowed from Dejan Sarka: ;WITH prc([Partition], [Rows]) AS ( SELECT $PARTITION.PartitionFunctionName(PartitioningColumn), COUNT(*) FROM dbo.TableName GROUP BY $PARTITION.PartitionFunctionName(PartitioningColumn) ), pds([Partition], [FileGroup]) AS ( SELECT ...


1

In order to validate your partitioning scheme, you can use the $PARTITION system function, detailed on MSDN at http://msdn.microsoft.com/en-us/library/ms188071.aspx Returns the partition number into which a set of partitioning column values would be mapped for any specified partition function So for your example, you could run: SELECT ...



Only top voted, non community-wiki answers of a minimum length are eligible