# CCNZ www.mscommunities.co.nz. What is going on here???

Slides:



Advertisements
Similar presentations
Filegroup “Stage A” Filegroup “Stage A” Filegroup “A” Partition 1,2 Filegroup “B” Partition 3,4 Filegroup “C” Partition 5,6 Filegroup “D” Partition.
Advertisements

Module 8 Importing and Exporting Data. Module Overview Transferring Data To/From SQL Server Importing & Exporting Table Data Inserting Data in Bulk.
Big Data Working with Terabytes in SQL Server Andrew Novick
Transaction Simon Cho. Who am I? Simon Cho Blog : Simonsql.com All Presentation and script will be on My.
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
10 Things Not To Do With SQL SQLBits 7. Some things you shouldn’t do.
André Kamman Friday November 20 SQLBITS IV. About Me  André Kamman  > 20 years in IT  Main focus on complex SQL Server environments (or a whole.
Architecting a Large-Scale Data Warehouse with SQL Server 2005 Mark Morton Senior Technical Consultant IT Training Solutions DAT313.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Implementing Database Snapshot & Database Mirroring in SQL Server 2005 Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP Microsoft.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
1 Demystifying the Transaction Log. 2 Rob Canzonire Advisory Database Administrator at Blue Cross Blue Shield of Louisiana Microsoft Certified Solutions.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
ISV Innovation Presented by ISV Innovation Presented by Business Intelligence Fundamentals: Data Loading Ola Ekdahl IT Mentors 9/12/08.
Architecture Rajesh. Components of Database Engine.
1 Chapter 14 DML Tuning. 2 DML Performance Fundamentals DML Performance is affected by: – Efficiency of WHERE clause – Amount of index maintenance – Referential.
MS SQL by: Bryan Bankhead CIS 407. General Concepts  Backing up and Restoring databases and transaction logs is a way that SQL Server provides protection.
Pedro Azevedo Lopes Premier Field Engineer Microsoft Corporation.
SQL Server 2005 – Table Partitioning Vinod Kumar Intel Technology India Pvt. Ltd. MVP – SQL Server
Master Data Management & Microsoft Master Data Services Presented By: Jeff Prom Data Architect MCTS - Business Intelligence (2008), Admin (2008), Developer.
Praveen Srivatsa Director| AstrhaSoft Consulting blogs.asthrasoft.com/praveens |
IT Faculty Software Engineering Seniors UML for a simple DataBase Management System Prepared by: أنس الأسود بشير الفروان زهير الزعبي ياسر المحمد.
Table Structures and Indexing. The concept of indexing If you were asked to search for the name “Adam Wilbert” in a phonebook, you would go directly to.
1 CS 430 Database Theory Winter 2005 Lecture 13: SQL DML - Modifying Data.
1 Indexes ► Sort data logically to improve the speed of searching and sorting operations. ► Provide rapid retrieval of specified rows from the table without.
Best Practices in Loading Large Datasets Asanka Padmakumara (BSc,MCTS) SQL Server Sri Lanka User Group Meeting Oct 2013.
SQL Server 2005 – Table Partitioning Chad Gronbach Microsoft.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
--A Gem of SQL Server 2012, particularly for Data Warehousing-- Present By Steven Wang.
6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation form at the end of the day in the Registration.
October 15-18, 2013 Charlotte, NC SQL Server Index Internals Tim Chapman Premier Field Engineer.
SQL Basics Review Reviewing what we’ve learned so far…….
Database Administration for the Non-DBA Denny Cherry twitter.com/mrdenny.
Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy.
Best Practices for Columnstore Indexes Warner Chaves SQL MCM / MVP SQLTurbo.com Pythian.com.
WHEN DATABASE CORRUPTION STRIKES Presented by Steve Stedman Founder/Owner of Stedman Solution, LLC.
Mastering Master Data Services Presented By: Jeff Prom BI Data Architect Bridgepoint Education MCTS - Business Intelligence, Admin, Developer.
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
Memory-Optimized Tables Querying at the speed of light.
Introduction to Partitioning in SQL Server
Data Warehouse ETL By Garrett EDmondson Thanks to our Gold Sponsors:
Partial Database Availability
Inside transaction logging
Temporal Databases Microsoft SQL Server 2016
Antonio Abalos Castillo
Designing Database Solutions for SQL Server
Example of a page header
# - it’s not about social media it’s about temporary tables and data
# - it’s not about social media it’s about temporary tables and data
The Nitty-Gritty of Database Backups
Chapter Overview Understanding the Database Architecture
The Ins and Outs of Partitioned Tables
Database Administration for the Non-DBA
Hitting the SQL Server “Go Faster” Button
Re-Indexing - The quest of ultimate automation
Introduction to partitioning
Welcome to SQL Saturday Denmark
Inside transaction logging
Turbo-Charged Transaction Logs
Table Partitioning Intro and make that a sliding window too!
In Memory OLTP Not Just for OLTP.
Table Partitioning Intro and make that a sliding window too!
Unleashing Stretched Databases
Transaction Log Internals and Performance David M Maxwell
Clustered Columnstore Indexes (SQL Server 2014)
Table Partitioning Intro and make that a sliding window too!
Bulk Load and Minimal Logging
In Memory OLTP Not Just for OLTP.
Partition Switching Joe Tempel.
Backup & Recovery.
Presentation transcript:

# CCNZ

What is going on here???

Steven Wang Senior DBA/Senior BI Specialist at BNZ MCITP/MCTS: BI Developer, Database Developer and Database Administrator Owner of TellYes Data Intelligence Blogs:

Agenda What Is minimal logging and why does it matter? What can be minimally logged? Metadata-Only Operations Things under the hood (Demo) Data Manoeuvring technics on very large tables Real world example Q & A

Small Quiz A.A minimally logged operation will always reduce the transaction log backup size? TrueFalse B.A minimally logged operation will always reduce the transaction log size? TrueFalse C.A minimally logged operation is always faster than fully logged operation ? TrueFalse

Answer A.A minimally logged operation will always reduce the transaction log backup size? TrueFalse B.A minimally logged operation will always reduce the transaction log size? TrueFalse C.A minimally logged operation is always faster than fully logged operation? TrueFalse

What is Minimal Logging and why does it matter? SQL server uses ‘write-ahead logging’. Everything has to be written on to log file first A minimally logged operation is one that does not always log every row; it only logs the extend allocations Transaction log will fill rapidly under full recovery model, it is likely to be grown during a large quantity of data operation “The transaction log is ALWAYS zero initialized when first created, manually grown, or auto- grown.” -- Paul Randal

What can be minimally logged? SELECT INTO …. FROM Table Bulk Import Operation:  BCP  BULK Insert  INSERT INTO … SELECT FROM OPENROWSET(BULK…) Create/Rebuild Index Using the.Write in the Update for new data The Creation of new heap by Dropping Index

Conditions It has to be under Bulk-Logged or Simple Recovery Model Table is not being replicated Tablock hint needs to be used Something talking about later

Conditions (Continue) Heap + Tablock

Conditions (Continue) Clustered + Tablock

Conditions (Continue) Use Trace Flag 610  Can be used to get minimal logging for empty heap and clustered table  Can be used to get minimal logging in a non-empty B-Tree  Tablock hint is not needed for table without nonclustered index  The first page is always fully logged Can be turned on instance-wide or session-wide Fully tested in your environment before use

Metadata-Only Operations Truncate Table Drop Table Partition Switch Partition Merge for 2 empty partitions Partition Split for an empty partition

Things Under the Hood (Demo)

Data Manoeuvring technics on very large tables Bulk Load Partitioned Table  Use parallelism, per bulk load per CPU core  Create staging tables having exactly same structure as target table in same filegroup with no indexes  Bulk load data into staging tables  Create indexes and constraints on staging tables.  Switch the staging tables into partitioned table partitions

Alter database MyDB Set recovery Bulk_Logged; Go Alter Database MyDB Modify Filegroup FG1 Default; GO Select Col1, Col2, Col3,… Into Stage_1 From Target_Table Where 0=1 Go... Go Alter Database MyDB Modify Filegroup FG4 Default; GO Select Col1, Col2, Col3,… Into Stage_4 From Target_Table Where 0=1 Go

1.Create Indexes; 2.Apply other settings to comply with target; 3.Create constraints;

Alter Table Stage_1 SWITCH TO MyTargetTable Partition 1; Go... Go Alter Table Stage_4 SWITCH TO MyTargetTable Partition 4;

Data Manoeuvring technics on very large tables (Continues) Delete a very large amount of rows in a table, for example, over 50% of the total  Don’t Delete! Think of using truncate or drop table instead. How??

Data Manoeuvring technics on very large tables (Continues) Really?? ?? Update a very large amount of rows in a table for majority of columns  Don’t Update! Think of using inserting data instead to achieve minimal logging.

Drop MyData Truncate MyData_New Rename MyData_Temp to MyData

I believe that you have already got a fairly good idea how to apply the similar technical to perform the update on partitioned table.

Real World Example A Table has to be partitioned daily The data has to be kept more than 7 years Every first day of the month a partition merge operation will be performed to consolidate one month’s partitions which is 30 month old to one partition How will you do it?

Thank You Blogs: Linkedin: wang/1b/ab/b8b wang/1b/ab/b8b

Premier Partners Sponsor Associated Partners Supporting Partners