SlideShare a Scribd company logo
How minimal logging
can help me?
Bartosz Ratajczyk
#534 | KRAKÓW 2016
Our Sponsors
11/29/201
6 |
Footer Goes Here2 |
SQL SATURDAY | #534 | KRAKÓW 2016
Our Partners
11/29/201
6 |
Footer Goes Here3 |
The plan
• What is minimal logging?
• How does it work?
(and when?)
• What are the profits?
(and downsides)
• What is efficient logging?
• TRUNCATE TABLE logging?
SQL SATURDAY | #534 | KRAKÓW 2016
Bartosz Ratajczyk
SQL Server consultant
Database programmer
ETL programmer
Database administrator
MCSE: Data Platform, MCT, MCTS SQL Server 2008
http://bartekr.net | b.ratajczyk@gmail.com
SQL SATURDAY | #534 | KRAKÓW 2016
Transaction log
• Keeps track of every data modification in a
database
• Quantity of information saved in a
transaction log may depend on recovery
model
SQL SATURDAY | #534 | KRAKÓW 2016
Recovery models
• FULL
• allows point-in-time recovery
• requires log management
• BULK LOGGED
• point-in-time recovery not possible
• requires log management
• SIMPLE
• point-in-time recovery not possible
• takes care of log management
Minimal logging
„At a minimum, enough information has to be logged when
minimally logged operation is performed to allow SQL Server to
rollback a transaction that has failed.”
Kalen Delaney, SQL Server Internals 2012
„Minimal logging involves logging only the information that is
required to recover the transaction without supporting point-in-
time recovery.”
BOL: https://msdn.microsoft.com/en-us/library/ms191244.aspx
SQL SATURDAY | #534 | KRAKÓW 2016
Minimal logging (simplified)
• Contains only data alocation information *)
• So we save on I/O operations
BUT:
• Log does not contain all information required to
recover lost data
• Log backup will contain pages that changed
*) well, not exactly
SQL SATURDAY | #534 | KRAKÓW 2016
Logging types (simplified)
• Full – the operation has its own log record
• Efficient – the changed page has its own
log record
• Minimal – we log only page allocation
operations *)
*) well, not exactly
SQL SATURDAY | #534 | KRAKÓW 2016
Log investigation
SELECT *
FROM fn_dblog(NULL, NULL)
SELECT *
FROM fn_dblog(@StartLSN, @EndLSN)
SQL SATURDAY | #534 | KRAKÓW 2016
DEMO
Minimal logging
What can be minimally logged?
• BULK INSERT
• bcp
• SELECT INTO
• INSERT INTO .. SELECT
• CREATE INDEX
• ALTER INDEX REBUILD, DBCC DBREINDEX
• REORGANIZE always fully logged
• .WRITE
• WRITETEXT, UPDATETEXT
DEPRECATED
SQL SATURDAY | #534 | KRAKÓW 2016
Requirements summary
non-FULL recovery model
AND NOT replicated
AND (
(Heap AND TABLOCK)
OR (B-tree AND empty AND TABLOCK)
OR (B-tree AND empty AND TF-610)
OR (B-tree AND nonempty AND TF-610 AND
NEW key-range)
)
Source: Itzik Ben-Gan, http://sqlmag.com/t-sql/minimally-logged-inserts
SQL SATURDAY | #534 | KRAKÓW 2016
One more trick
If you can’t use TABLOCK then use:
EXEC sys.sp_tableoption
@TableNamePattern = N’dbo.Table’,
@OptionName = ’table lock on bulk load’,
@OptionValue = ’ON’
SQL SATURDAY | #534 | KRAKÓW 2016
Pros
• Faster transactions and log saving
• Smaller I/O
SQL SATURDAY | #534 | KRAKÓW 2016
And not pros
• Sensitive for data file errors
• Requires SIMPLE recovery model or switching
between FULL and BULK LOGGED
• So we won’t use Mirroring and Availability Groups
• But Log Shipping still can work
• May require TF 610 – sysadmin
• All data pages have to be written to disk before
transaction ends
SQL SATURDAY | #534 | KRAKÓW 2016
TRUNCATE TABLE
• Lightning fast data deletion
• Is it logged or not?
• Why is it so fast?
SQL SATURDAY | #534 | KRAKÓW 2016
DEMO
TRUNCATE TABLE
What to remember
• Minimal logging is just saving page
allocation information in transaction log *)
• It makes some operations quick, but is
sensitive for data file errors
• TRUNCATE is fully logged operation
*) well, not exactly
SQL SATURDAY | #534 | KRAKÓW 2016
Some things to read
• Itzik Ben-Gan „Minimally logged inserts: http://sqlmag.com/t-
sql/minimally-logged-inserts
• Gail Shaw, Tony Davis „Managing the Log in BULK_LOGGED
Recovery Model”
http://www.sqlservercentral.com/articles/Stairway+Series/94552/
• Paul Randall „The Myth that DROP and TRUNCATE TABLE are
Non-Logged” http://sqlperformance.com/2013/05/sql-
performance/drop-truncate-log-myth
• Remus Rusanu „How to read and interpret the SQL Server log”
http://rusanu.com/2014/03/10/how-to-read-and-interpret-the-sql-
server-log/
SQL SATURDAY | #534 | KRAKÓW 2016
Our Sponsors
11/29/201
6 |
Footer Goes Here22 |
SQL SATURDAY | #534 | KRAKÓW 2016
Our Partners
11/29/201
6 |
Footer Goes Here23 |
Bartosz Ratajczyk
#534 | KRAKÓW 2016

More Related Content

What's hot

Icinga Camp Bangalore - Icinga and Icinga Director
Icinga Camp Bangalore - Icinga and Icinga Director Icinga Camp Bangalore - Icinga and Icinga Director
Icinga Camp Bangalore - Icinga and Icinga Director
Icinga
 
Icinga Camp Belgrade - Icinga Web 2
Icinga Camp Belgrade - Icinga Web 2Icinga Camp Belgrade - Icinga Web 2
Icinga Camp Belgrade - Icinga Web 2
Icinga
 
Loadays 2015 - Enterprise Monitoring with Icinga
Loadays 2015 - Enterprise Monitoring with IcingaLoadays 2015 - Enterprise Monitoring with Icinga
Loadays 2015 - Enterprise Monitoring with Icinga
Icinga
 
Introduction into Icinga Web 2
Introduction into Icinga Web 2Introduction into Icinga Web 2
Introduction into Icinga Web 2
Icinga
 
The journey of Moving from AWS ELK to GCP Data Pipeline
The journey of Moving from AWS ELK to GCP Data PipelineThe journey of Moving from AWS ELK to GCP Data Pipeline
The journey of Moving from AWS ELK to GCP Data Pipeline
Randy Huang
 
WEBridge 4 SAP ( Windchill and SAP Integration)
WEBridge 4 SAP ( Windchill and SAP Integration)WEBridge 4 SAP ( Windchill and SAP Integration)
WEBridge 4 SAP ( Windchill and SAP Integration)
Gandhavalla Informatics Pvt Ltd.
 
Customizing Online Services for a Better Experience
Customizing Online Services for a Better ExperienceCustomizing Online Services for a Better Experience
Customizing Online Services for a Better Experience
APNIC
 
Sqlwatch presentation 2018-11
Sqlwatch presentation 2018-11Sqlwatch presentation 2018-11
Sqlwatch presentation 2018-11
Marcin Gminski
 
Icinga Web 2 is more
Icinga Web 2 is moreIcinga Web 2 is more
Icinga Web 2 is more
Icinga
 
IcingaCamp Stockholm - Graphing with Graphite und Grafana
IcingaCamp Stockholm - Graphing with Graphite und GrafanaIcingaCamp Stockholm - Graphing with Graphite und Grafana
IcingaCamp Stockholm - Graphing with Graphite und Grafana
Icinga
 
Saluki - do it like a user
Saluki - do it like a userSaluki - do it like a user
Saluki - do it like a user
Icinga
 
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
Icinga
 
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
Gandhavalla Informatics Pvt Ltd.
 
informatica Online Training Institute in India,USA,UK,Canada.
informatica Online Training Institute in India,USA,UK,Canada.informatica Online Training Institute in India,USA,UK,Canada.
informatica Online Training Institute in India,USA,UK,Canada.
Angel Maxwel
 
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configurationIcinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
Icinga
 
Icinga Camp Amsterdam - Icinga Director
Icinga Camp Amsterdam - Icinga DirectorIcinga Camp Amsterdam - Icinga Director
Icinga Camp Amsterdam - Icinga Director
Icinga
 
Icinga Camp Bangalore - Welcome
Icinga Camp Bangalore - WelcomeIcinga Camp Bangalore - Welcome
Icinga Camp Bangalore - Welcome
Icinga
 
Icinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them allIcinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them all
Icinga
 
June 2018 spc recap visual
June 2018 spc recap visualJune 2018 spc recap visual
June 2018 spc recap visual
Caitlin Young
 
Core FP Concepts
Core FP ConceptsCore FP Concepts
Core FP Concepts
Diego Pacheco
 

What's hot (20)

Icinga Camp Bangalore - Icinga and Icinga Director
Icinga Camp Bangalore - Icinga and Icinga Director Icinga Camp Bangalore - Icinga and Icinga Director
Icinga Camp Bangalore - Icinga and Icinga Director
 
Icinga Camp Belgrade - Icinga Web 2
Icinga Camp Belgrade - Icinga Web 2Icinga Camp Belgrade - Icinga Web 2
Icinga Camp Belgrade - Icinga Web 2
 
Loadays 2015 - Enterprise Monitoring with Icinga
Loadays 2015 - Enterprise Monitoring with IcingaLoadays 2015 - Enterprise Monitoring with Icinga
Loadays 2015 - Enterprise Monitoring with Icinga
 
Introduction into Icinga Web 2
Introduction into Icinga Web 2Introduction into Icinga Web 2
Introduction into Icinga Web 2
 
The journey of Moving from AWS ELK to GCP Data Pipeline
The journey of Moving from AWS ELK to GCP Data PipelineThe journey of Moving from AWS ELK to GCP Data Pipeline
The journey of Moving from AWS ELK to GCP Data Pipeline
 
WEBridge 4 SAP ( Windchill and SAP Integration)
WEBridge 4 SAP ( Windchill and SAP Integration)WEBridge 4 SAP ( Windchill and SAP Integration)
WEBridge 4 SAP ( Windchill and SAP Integration)
 
Customizing Online Services for a Better Experience
Customizing Online Services for a Better ExperienceCustomizing Online Services for a Better Experience
Customizing Online Services for a Better Experience
 
Sqlwatch presentation 2018-11
Sqlwatch presentation 2018-11Sqlwatch presentation 2018-11
Sqlwatch presentation 2018-11
 
Icinga Web 2 is more
Icinga Web 2 is moreIcinga Web 2 is more
Icinga Web 2 is more
 
IcingaCamp Stockholm - Graphing with Graphite und Grafana
IcingaCamp Stockholm - Graphing with Graphite und GrafanaIcingaCamp Stockholm - Graphing with Graphite und Grafana
IcingaCamp Stockholm - Graphing with Graphite und Grafana
 
Saluki - do it like a user
Saluki - do it like a userSaluki - do it like a user
Saluki - do it like a user
 
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
Icinga Camp Berlin 2018 - Dev and Ops Stories - Integrations++
 
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
 
informatica Online Training Institute in India,USA,UK,Canada.
informatica Online Training Institute in India,USA,UK,Canada.informatica Online Training Institute in India,USA,UK,Canada.
informatica Online Training Institute in India,USA,UK,Canada.
 
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configurationIcinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
Icinga Camp San Francisco 2017 - Icinga Director - Managing your configuration
 
Icinga Camp Amsterdam - Icinga Director
Icinga Camp Amsterdam - Icinga DirectorIcinga Camp Amsterdam - Icinga Director
Icinga Camp Amsterdam - Icinga Director
 
Icinga Camp Bangalore - Welcome
Icinga Camp Bangalore - WelcomeIcinga Camp Bangalore - Welcome
Icinga Camp Bangalore - Welcome
 
Icinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them allIcinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them all
 
June 2018 spc recap visual
June 2018 spc recap visualJune 2018 spc recap visual
June 2018 spc recap visual
 
Core FP Concepts
Core FP ConceptsCore FP Concepts
Core FP Concepts
 

Viewers also liked

Podstawy ETL z SSIS
Podstawy ETL z SSISPodstawy ETL z SSIS
Podstawy ETL z SSIS
Bartosz Ratajczyk
 
Szkolenia i certyfikacjesqlserver2016_plssug99
Szkolenia i certyfikacjesqlserver2016_plssug99Szkolenia i certyfikacjesqlserver2016_plssug99
Szkolenia i certyfikacjesqlserver2016_plssug99
Bartosz Ratajczyk
 
SQL Server 2016 JSON
SQL Server 2016 JSONSQL Server 2016 JSON
SQL Server 2016 JSON
Davide Mauri
 
Azure Machine Learning
Azure Machine LearningAzure Machine Learning
Azure Machine Learning
Davide Mauri
 
Back to the roots - SQL Server Indexing
Back to the roots - SQL Server IndexingBack to the roots - SQL Server Indexing
Back to the roots - SQL Server Indexing
Davide Mauri
 
BIML: BI to the next level
BIML: BI to the next levelBIML: BI to the next level
BIML: BI to the next level
Davide Mauri
 
Azure ML: from basic to integration with custom applications
Azure ML: from basic to integration with custom applicationsAzure ML: from basic to integration with custom applications
Azure ML: from basic to integration with custom applications
Davide Mauri
 
SSIS Monitoring Deep Dive
SSIS Monitoring Deep DiveSSIS Monitoring Deep Dive
SSIS Monitoring Deep Dive
Davide Mauri
 
Azure Stream Analytics
Azure Stream AnalyticsAzure Stream Analytics
Azure Stream Analytics
Davide Mauri
 
Event Hub & Azure Stream Analytics
Event Hub & Azure Stream AnalyticsEvent Hub & Azure Stream Analytics
Event Hub & Azure Stream Analytics
Davide Mauri
 
SQL Server 2016 What's New For Developers
SQL Server 2016  What's New For DevelopersSQL Server 2016  What's New For Developers
SQL Server 2016 What's New For Developers
Davide Mauri
 
Datarace: IoT e Big Data (Italian)
Datarace: IoT e Big Data (Italian)Datarace: IoT e Big Data (Italian)
Datarace: IoT e Big Data (Italian)
Davide Mauri
 
Data juice
Data juiceData juice
Data juice
Davide Mauri
 
Real Time Power BI
Real Time Power BIReal Time Power BI
Real Time Power BI
Davide Mauri
 
AzureML - Creating and Using Machine Learning Solutions (Italian)
AzureML - Creating and Using Machine Learning Solutions (Italian)AzureML - Creating and Using Machine Learning Solutions (Italian)
AzureML - Creating and Using Machine Learning Solutions (Italian)
Davide Mauri
 
Agile Data Warehousing
Agile Data WarehousingAgile Data Warehousing
Agile Data Warehousing
Davide Mauri
 
Azure Machine Learning (Italian)
Azure Machine Learning (Italian)Azure Machine Learning (Italian)
Azure Machine Learning (Italian)
Davide Mauri
 
Iris Multi-Class Classifier with Azure ML
Iris Multi-Class Classifier with Azure MLIris Multi-Class Classifier with Azure ML
Iris Multi-Class Classifier with Azure ML
Davide Mauri
 
Dashboarding with Microsoft: Datazen & Power BI
Dashboarding with Microsoft: Datazen & Power BIDashboarding with Microsoft: Datazen & Power BI
Dashboarding with Microsoft: Datazen & Power BI
Davide Mauri
 
SQL Server 2016 Temporal Tables
SQL Server 2016 Temporal TablesSQL Server 2016 Temporal Tables
SQL Server 2016 Temporal Tables
Davide Mauri
 

Viewers also liked (20)

Podstawy ETL z SSIS
Podstawy ETL z SSISPodstawy ETL z SSIS
Podstawy ETL z SSIS
 
Szkolenia i certyfikacjesqlserver2016_plssug99
Szkolenia i certyfikacjesqlserver2016_plssug99Szkolenia i certyfikacjesqlserver2016_plssug99
Szkolenia i certyfikacjesqlserver2016_plssug99
 
SQL Server 2016 JSON
SQL Server 2016 JSONSQL Server 2016 JSON
SQL Server 2016 JSON
 
Azure Machine Learning
Azure Machine LearningAzure Machine Learning
Azure Machine Learning
 
Back to the roots - SQL Server Indexing
Back to the roots - SQL Server IndexingBack to the roots - SQL Server Indexing
Back to the roots - SQL Server Indexing
 
BIML: BI to the next level
BIML: BI to the next levelBIML: BI to the next level
BIML: BI to the next level
 
Azure ML: from basic to integration with custom applications
Azure ML: from basic to integration with custom applicationsAzure ML: from basic to integration with custom applications
Azure ML: from basic to integration with custom applications
 
SSIS Monitoring Deep Dive
SSIS Monitoring Deep DiveSSIS Monitoring Deep Dive
SSIS Monitoring Deep Dive
 
Azure Stream Analytics
Azure Stream AnalyticsAzure Stream Analytics
Azure Stream Analytics
 
Event Hub & Azure Stream Analytics
Event Hub & Azure Stream AnalyticsEvent Hub & Azure Stream Analytics
Event Hub & Azure Stream Analytics
 
SQL Server 2016 What's New For Developers
SQL Server 2016  What's New For DevelopersSQL Server 2016  What's New For Developers
SQL Server 2016 What's New For Developers
 
Datarace: IoT e Big Data (Italian)
Datarace: IoT e Big Data (Italian)Datarace: IoT e Big Data (Italian)
Datarace: IoT e Big Data (Italian)
 
Data juice
Data juiceData juice
Data juice
 
Real Time Power BI
Real Time Power BIReal Time Power BI
Real Time Power BI
 
AzureML - Creating and Using Machine Learning Solutions (Italian)
AzureML - Creating and Using Machine Learning Solutions (Italian)AzureML - Creating and Using Machine Learning Solutions (Italian)
AzureML - Creating and Using Machine Learning Solutions (Italian)
 
Agile Data Warehousing
Agile Data WarehousingAgile Data Warehousing
Agile Data Warehousing
 
Azure Machine Learning (Italian)
Azure Machine Learning (Italian)Azure Machine Learning (Italian)
Azure Machine Learning (Italian)
 
Iris Multi-Class Classifier with Azure ML
Iris Multi-Class Classifier with Azure MLIris Multi-Class Classifier with Azure ML
Iris Multi-Class Classifier with Azure ML
 
Dashboarding with Microsoft: Datazen & Power BI
Dashboarding with Microsoft: Datazen & Power BIDashboarding with Microsoft: Datazen & Power BI
Dashboarding with Microsoft: Datazen & Power BI
 
SQL Server 2016 Temporal Tables
SQL Server 2016 Temporal TablesSQL Server 2016 Temporal Tables
SQL Server 2016 Temporal Tables
 

Similar to How minimalloggingcanhelpme bartoszratajczyk_sql_sat534

2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log
HVR Software
 
Le novità di sql server 2019
Le novità di sql server 2019Le novità di sql server 2019
Le novità di sql server 2019
Gianluca Hotz
 
SQL Server 2022 Programmability & Performance
SQL Server 2022 Programmability & PerformanceSQL Server 2022 Programmability & Performance
SQL Server 2022 Programmability & Performance
Gianluca Hotz
 
Fun Things to do with Logical Decoding
Fun Things to do with Logical DecodingFun Things to do with Logical Decoding
Fun Things to do with Logical Decoding
Mike Fowler
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New Features
FromDual GmbH
 
Writing Futuristic Workflows in Office 365 SharePoint 2013 2016 on premise
Writing Futuristic Workflows in Office 365 SharePoint 2013 2016 on premiseWriting Futuristic Workflows in Office 365 SharePoint 2013 2016 on premise
Writing Futuristic Workflows in Office 365 SharePoint 2013 2016 on premise
Prashant G Bhoyar (Microsoft MVP)
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
Alfredo Abate
 
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginnersKoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
Tobias Koprowski
 
Exploring plsql new features best practices september 2013
Exploring plsql new features best practices   september 2013Exploring plsql new features best practices   september 2013
Exploring plsql new features best practices september 2013
Andrejs Vorobjovs
 
Recovery, logging and the transaction log
Recovery, logging and the transaction logRecovery, logging and the transaction log
Recovery, logging and the transaction log
Miroslav Dimitrov
 
[JSS2015] AlwaysOn 2016
[JSS2015] AlwaysOn 2016[JSS2015] AlwaysOn 2016
[JSS2015] AlwaysOn 2016
GUSS
 
Tailor azure log analytics with kusto queries
Tailor azure log analytics with kusto queriesTailor azure log analytics with kusto queries
Tailor azure log analytics with kusto queries
Samik Roy
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
Kevin Kline
 
MySQL 5.6 Replication Webinar
MySQL 5.6 Replication WebinarMySQL 5.6 Replication Webinar
MySQL 5.6 Replication Webinar
Mark Swarbrick
 
How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?
How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?
How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?
Prashant G Bhoyar (Microsoft MVP)
 
Monitoring sql server
Monitoring sql serverMonitoring sql server
Monitoring sql server
John Martin
 
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored ProceduresM|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
MariaDB plc
 
Migrations from PLSQL and Transact-SQL - m18
Migrations from PLSQL and Transact-SQL - m18Migrations from PLSQL and Transact-SQL - m18
Migrations from PLSQL and Transact-SQL - m18
Wagner Bianchi
 
Wtu 2014 ibm web sphere mq for zos - performance and accounting
Wtu 2014   ibm web sphere mq for zos - performance and accountingWtu 2014   ibm web sphere mq for zos - performance and accounting
Wtu 2014 ibm web sphere mq for zos - performance and accounting
Alexander Ross
 
Advanced Office365 Sharepoint online Workflows
Advanced Office365 Sharepoint online WorkflowsAdvanced Office365 Sharepoint online Workflows
Advanced Office365 Sharepoint online Workflows
Prashant G Bhoyar (Microsoft MVP)
 

Similar to How minimalloggingcanhelpme bartoszratajczyk_sql_sat534 (20)

2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log2016 04 sqlsaturday_transaction_log
2016 04 sqlsaturday_transaction_log
 
Le novità di sql server 2019
Le novità di sql server 2019Le novità di sql server 2019
Le novità di sql server 2019
 
SQL Server 2022 Programmability & Performance
SQL Server 2022 Programmability & PerformanceSQL Server 2022 Programmability & Performance
SQL Server 2022 Programmability & Performance
 
Fun Things to do with Logical Decoding
Fun Things to do with Logical DecodingFun Things to do with Logical Decoding
Fun Things to do with Logical Decoding
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New Features
 
Writing Futuristic Workflows in Office 365 SharePoint 2013 2016 on premise
Writing Futuristic Workflows in Office 365 SharePoint 2013 2016 on premiseWriting Futuristic Workflows in Office 365 SharePoint 2013 2016 on premise
Writing Futuristic Workflows in Office 365 SharePoint 2013 2016 on premise
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
 
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginnersKoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#4_Caerdydd_MaintenancePlansForBeginners
 
Exploring plsql new features best practices september 2013
Exploring plsql new features best practices   september 2013Exploring plsql new features best practices   september 2013
Exploring plsql new features best practices september 2013
 
Recovery, logging and the transaction log
Recovery, logging and the transaction logRecovery, logging and the transaction log
Recovery, logging and the transaction log
 
[JSS2015] AlwaysOn 2016
[JSS2015] AlwaysOn 2016[JSS2015] AlwaysOn 2016
[JSS2015] AlwaysOn 2016
 
Tailor azure log analytics with kusto queries
Tailor azure log analytics with kusto queriesTailor azure log analytics with kusto queries
Tailor azure log analytics with kusto queries
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 
MySQL 5.6 Replication Webinar
MySQL 5.6 Replication WebinarMySQL 5.6 Replication Webinar
MySQL 5.6 Replication Webinar
 
How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?
How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?
How to Develop Maintainable Custom Workflows in Office 365 Share Point Online?
 
Monitoring sql server
Monitoring sql serverMonitoring sql server
Monitoring sql server
 
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored ProceduresM|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
 
Migrations from PLSQL and Transact-SQL - m18
Migrations from PLSQL and Transact-SQL - m18Migrations from PLSQL and Transact-SQL - m18
Migrations from PLSQL and Transact-SQL - m18
 
Wtu 2014 ibm web sphere mq for zos - performance and accounting
Wtu 2014   ibm web sphere mq for zos - performance and accountingWtu 2014   ibm web sphere mq for zos - performance and accounting
Wtu 2014 ibm web sphere mq for zos - performance and accounting
 
Advanced Office365 Sharepoint online Workflows
Advanced Office365 Sharepoint online WorkflowsAdvanced Office365 Sharepoint online Workflows
Advanced Office365 Sharepoint online Workflows
 

More from Bartosz Ratajczyk

SQL Server + docker - pierwsze kroki
SQL Server + docker - pierwsze krokiSQL Server + docker - pierwsze kroki
SQL Server + docker - pierwsze kroki
Bartosz Ratajczyk
 
OLE DB - kiedy FastLoad nie jest takie fast
OLE DB - kiedy FastLoad nie jest takie fastOLE DB - kiedy FastLoad nie jest takie fast
OLE DB - kiedy FastLoad nie jest takie fast
Bartosz Ratajczyk
 
Jak działa rekurencyjne CTE?
Jak działa rekurencyjne CTE?Jak działa rekurencyjne CTE?
Jak działa rekurencyjne CTE?
Bartosz Ratajczyk
 
SqlSaturday Denmark 2017 - Automate your SSIS deployment process
SqlSaturday Denmark 2017 - Automate your SSIS deployment processSqlSaturday Denmark 2017 - Automate your SSIS deployment process
SqlSaturday Denmark 2017 - Automate your SSIS deployment process
Bartosz Ratajczyk
 
"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać
"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać
"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać
Bartosz Ratajczyk
 
Zautomatyzuj swój proces wdrażania projektów SSIS
Zautomatyzuj swój proces wdrażania projektów SSISZautomatyzuj swój proces wdrażania projektów SSIS
Zautomatyzuj swój proces wdrażania projektów SSIS
Bartosz Ratajczyk
 
XML w SQL Server w praktyce
XML w SQL Server w praktyceXML w SQL Server w praktyce
XML w SQL Server w praktyce
Bartosz Ratajczyk
 
Jak szybko przetwarzasz hurtowe ilości XML?
Jak szybko przetwarzasz hurtowe ilości XML?Jak szybko przetwarzasz hurtowe ilości XML?
Jak szybko przetwarzasz hurtowe ilości XML?
Bartosz Ratajczyk
 
Operacje minimalnie logowane
Operacje minimalnie logowaneOperacje minimalnie logowane
Operacje minimalnie logowane
Bartosz Ratajczyk
 
Po co mi Temporal Tables?
Po co mi Temporal Tables?Po co mi Temporal Tables?
Po co mi Temporal Tables?
Bartosz Ratajczyk
 
Co to te CTE?
Co to te CTE?Co to te CTE?
Co to te CTE?
Bartosz Ratajczyk
 
O co chodzi z FILESTREAM?
O co chodzi z FILESTREAM?O co chodzi z FILESTREAM?
O co chodzi z FILESTREAM?
Bartosz Ratajczyk
 
Alerty WMI
Alerty WMIAlerty WMI
Alerty WMI
Bartosz Ratajczyk
 
Czy mi się przyda hierarchyid?
Czy mi się przyda hierarchyid?Czy mi się przyda hierarchyid?
Czy mi się przyda hierarchyid?
Bartosz Ratajczyk
 

More from Bartosz Ratajczyk (14)

SQL Server + docker - pierwsze kroki
SQL Server + docker - pierwsze krokiSQL Server + docker - pierwsze kroki
SQL Server + docker - pierwsze kroki
 
OLE DB - kiedy FastLoad nie jest takie fast
OLE DB - kiedy FastLoad nie jest takie fastOLE DB - kiedy FastLoad nie jest takie fast
OLE DB - kiedy FastLoad nie jest takie fast
 
Jak działa rekurencyjne CTE?
Jak działa rekurencyjne CTE?Jak działa rekurencyjne CTE?
Jak działa rekurencyjne CTE?
 
SqlSaturday Denmark 2017 - Automate your SSIS deployment process
SqlSaturday Denmark 2017 - Automate your SSIS deployment processSqlSaturday Denmark 2017 - Automate your SSIS deployment process
SqlSaturday Denmark 2017 - Automate your SSIS deployment process
 
"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać
"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać
"Administrator z przypadku" - Jak działa SQL Server i jak o niego dbać
 
Zautomatyzuj swój proces wdrażania projektów SSIS
Zautomatyzuj swój proces wdrażania projektów SSISZautomatyzuj swój proces wdrażania projektów SSIS
Zautomatyzuj swój proces wdrażania projektów SSIS
 
XML w SQL Server w praktyce
XML w SQL Server w praktyceXML w SQL Server w praktyce
XML w SQL Server w praktyce
 
Jak szybko przetwarzasz hurtowe ilości XML?
Jak szybko przetwarzasz hurtowe ilości XML?Jak szybko przetwarzasz hurtowe ilości XML?
Jak szybko przetwarzasz hurtowe ilości XML?
 
Operacje minimalnie logowane
Operacje minimalnie logowaneOperacje minimalnie logowane
Operacje minimalnie logowane
 
Po co mi Temporal Tables?
Po co mi Temporal Tables?Po co mi Temporal Tables?
Po co mi Temporal Tables?
 
Co to te CTE?
Co to te CTE?Co to te CTE?
Co to te CTE?
 
O co chodzi z FILESTREAM?
O co chodzi z FILESTREAM?O co chodzi z FILESTREAM?
O co chodzi z FILESTREAM?
 
Alerty WMI
Alerty WMIAlerty WMI
Alerty WMI
 
Czy mi się przyda hierarchyid?
Czy mi się przyda hierarchyid?Czy mi się przyda hierarchyid?
Czy mi się przyda hierarchyid?
 

Recently uploaded

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 

Recently uploaded (20)

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 

How minimalloggingcanhelpme bartoszratajczyk_sql_sat534

  • 1. How minimal logging can help me? Bartosz Ratajczyk #534 | KRAKÓW 2016
  • 2. Our Sponsors 11/29/201 6 | Footer Goes Here2 | SQL SATURDAY | #534 | KRAKÓW 2016
  • 4. The plan • What is minimal logging? • How does it work? (and when?) • What are the profits? (and downsides) • What is efficient logging? • TRUNCATE TABLE logging? SQL SATURDAY | #534 | KRAKÓW 2016
  • 5. Bartosz Ratajczyk SQL Server consultant Database programmer ETL programmer Database administrator MCSE: Data Platform, MCT, MCTS SQL Server 2008 http://bartekr.net | b.ratajczyk@gmail.com SQL SATURDAY | #534 | KRAKÓW 2016
  • 6. Transaction log • Keeps track of every data modification in a database • Quantity of information saved in a transaction log may depend on recovery model SQL SATURDAY | #534 | KRAKÓW 2016
  • 7. Recovery models • FULL • allows point-in-time recovery • requires log management • BULK LOGGED • point-in-time recovery not possible • requires log management • SIMPLE • point-in-time recovery not possible • takes care of log management
  • 8. Minimal logging „At a minimum, enough information has to be logged when minimally logged operation is performed to allow SQL Server to rollback a transaction that has failed.” Kalen Delaney, SQL Server Internals 2012 „Minimal logging involves logging only the information that is required to recover the transaction without supporting point-in- time recovery.” BOL: https://msdn.microsoft.com/en-us/library/ms191244.aspx SQL SATURDAY | #534 | KRAKÓW 2016
  • 9. Minimal logging (simplified) • Contains only data alocation information *) • So we save on I/O operations BUT: • Log does not contain all information required to recover lost data • Log backup will contain pages that changed *) well, not exactly SQL SATURDAY | #534 | KRAKÓW 2016
  • 10. Logging types (simplified) • Full – the operation has its own log record • Efficient – the changed page has its own log record • Minimal – we log only page allocation operations *) *) well, not exactly SQL SATURDAY | #534 | KRAKÓW 2016
  • 11. Log investigation SELECT * FROM fn_dblog(NULL, NULL) SELECT * FROM fn_dblog(@StartLSN, @EndLSN) SQL SATURDAY | #534 | KRAKÓW 2016
  • 13. What can be minimally logged? • BULK INSERT • bcp • SELECT INTO • INSERT INTO .. SELECT • CREATE INDEX • ALTER INDEX REBUILD, DBCC DBREINDEX • REORGANIZE always fully logged • .WRITE • WRITETEXT, UPDATETEXT DEPRECATED SQL SATURDAY | #534 | KRAKÓW 2016
  • 14. Requirements summary non-FULL recovery model AND NOT replicated AND ( (Heap AND TABLOCK) OR (B-tree AND empty AND TABLOCK) OR (B-tree AND empty AND TF-610) OR (B-tree AND nonempty AND TF-610 AND NEW key-range) ) Source: Itzik Ben-Gan, http://sqlmag.com/t-sql/minimally-logged-inserts SQL SATURDAY | #534 | KRAKÓW 2016
  • 15. One more trick If you can’t use TABLOCK then use: EXEC sys.sp_tableoption @TableNamePattern = N’dbo.Table’, @OptionName = ’table lock on bulk load’, @OptionValue = ’ON’ SQL SATURDAY | #534 | KRAKÓW 2016
  • 16. Pros • Faster transactions and log saving • Smaller I/O SQL SATURDAY | #534 | KRAKÓW 2016
  • 17. And not pros • Sensitive for data file errors • Requires SIMPLE recovery model or switching between FULL and BULK LOGGED • So we won’t use Mirroring and Availability Groups • But Log Shipping still can work • May require TF 610 – sysadmin • All data pages have to be written to disk before transaction ends SQL SATURDAY | #534 | KRAKÓW 2016
  • 18. TRUNCATE TABLE • Lightning fast data deletion • Is it logged or not? • Why is it so fast? SQL SATURDAY | #534 | KRAKÓW 2016
  • 20. What to remember • Minimal logging is just saving page allocation information in transaction log *) • It makes some operations quick, but is sensitive for data file errors • TRUNCATE is fully logged operation *) well, not exactly SQL SATURDAY | #534 | KRAKÓW 2016
  • 21. Some things to read • Itzik Ben-Gan „Minimally logged inserts: http://sqlmag.com/t- sql/minimally-logged-inserts • Gail Shaw, Tony Davis „Managing the Log in BULK_LOGGED Recovery Model” http://www.sqlservercentral.com/articles/Stairway+Series/94552/ • Paul Randall „The Myth that DROP and TRUNCATE TABLE are Non-Logged” http://sqlperformance.com/2013/05/sql- performance/drop-truncate-log-myth • Remus Rusanu „How to read and interpret the SQL Server log” http://rusanu.com/2014/03/10/how-to-read-and-interpret-the-sql- server-log/ SQL SATURDAY | #534 | KRAKÓW 2016
  • 22. Our Sponsors 11/29/201 6 | Footer Goes Here22 | SQL SATURDAY | #534 | KRAKÓW 2016
  • 24. Bartosz Ratajczyk #534 | KRAKÓW 2016