Add files via upload

This commit is contained in:
Bob Ward
2016-09-17 17:32:29 -05:00
committed by GitHub
parent 69efa93d94
commit 0a1f9a9ba7
4 changed files with 72 additions and 1 deletions
@@ -0,0 +1,2 @@
DROP EVENT SESSION [recoverytraces] ON SERVER
go
@@ -9,7 +9,7 @@ go
begin tran
declare @x int
set @x = 0
while (@x < 5000000)
while (@x < 2500000)
begin
set @x = @x + 1
insert into watchinsertsfly values (@x, 'x')
@@ -18,6 +18,10 @@ commit tran
go
set nocount off
go
-- Build an empty table to use for INSERT...SELECT
--
drop table parallelinserts
go
select * into parallelinserts from watchinsertsfly where 1 = 2
go
checkpoint
@@ -0,0 +1,46 @@
use insert_is_faster_in_2016
go
-- Change the target recovery interval to a high really high number to avoid any indirect checkpoints
--
ALTER DATABASE insert_is_faster_in_2016 SET TARGET_RECOVERY_TIME = 50000 minutes
go
-- STEP 1: Test out parallel redo
--
-- Truncate the target table
truncate table parallelinserts
go
-- Insert and delete rows from the table
insert into parallelinserts WITH (TABLOCK) select * from watchinsertsfly
delete from parallelinserts
go
-- Now you need to kill the SQLSERVR.EXE process without a clean shutdown or checkpoint. COME BACK HERE WHEN DONE
-- Restart the SQL Server Service and come back to this point
-- See what tasks are running for a parallel redo. Look for a command = PARALLEL REDO TASK
select * from sys.dm_exec_requests
go
-- Check the ERRORLOG output note the total time it takes to perform redo
-- Look at the XEvent file output to see the parallel redo activity
--
-- STEP 2: Test out redo without parallelism
--
-- Let's do this again but this time use a trace flag to not use parallel redo
--
use insert_is_faster_in_2016
go
-- Truncate the target table
truncate table parallelinserts
go
-- Insert and delete rows from the table
insert into parallelinserts WITH (TABLOCK) select * from watchinsertsfly
delete from parallelinserts
go
-- Now you need to kill the SQLSERVR.EXE process without a clean shutdown or checkpoint. COME BACK HERE WHEN DONE
-- Restart the SQL Server Service with trace flag /T3459 to see the redo activity in the ERRORLOG. Note the differences from before.
-- See what tasks are running for redo
select * from sys.dm_exec_requests
go
-- Check the ERRORLOG output to see redo activity and total time it takes without parallel redo
-- Check the result of the Extended Events Session and notice no parallel redo activity or workers are logged
@@ -0,0 +1,19 @@
DROP EVENT SESSION [recoverytraces] ON SERVER
go
-- Note here that we create this as a startup event session
-- but don't start it. That is because since we created it for
-- startup it will be started when SQL Server starts (but before rcovery is run)
CREATE EVENT SESSION [recoverytraces] ON SERVER
ADD EVENT sqlserver.database_recovery_progress_report,
ADD EVENT sqlserver.database_recovery_times,
ADD EVENT sqlserver.database_recovery_trace,
ADD EVENT sqlserver.recovery_catch_checkpoint,
ADD EVENT sqlserver.recovery_force_oldest_page,
ADD EVENT sqlserver.recovery_indirect_checkpoint,
ADD EVENT sqlserver.recovery_simple_log_truncate,
ADD EVENT sqlserver.recovery_skip_checkpoint,
ADD EVENT sqlserver.recovery_target_miss,
ADD EVENT sqlserver.recovery_target_reset
ADD TARGET package0.event_file(SET filename=N'C:\temp\recoverytraces.xel',max_file_size=(512),max_rollover_files=(10))
WITH (MAX_MEMORY=32768 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=PER_CPU,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON)
GO