sql server enterprise - download.microsoft.com server...sql server enterprise ... •alter...

41
SQL SERVER ENTERPRISE AWARENESS Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Upload: vothu

Post on 09-Jun-2018

275 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

SQL SERVER ENTERPRISE AWARENESS

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 2: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

About MeHamid J. Fard

I am SQL Server Data Platform Expert with more than 9 years’ of professionalexperience, I am currently Microsoft Certified Master: SQL Server 2008,Microsoft Certified Solutions Master: Charter-Data Platform, Microsoft DataPlatform MVP and CIW Database Design Specialist. After a few years of being aproduction database administrator I jumped into the role of Data PlatformExpert. Being a consultant allows me to work directly with customers to helpsolve questions regarding database issues for SQL Server.

Page 3: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Agenda• What Matters To You?

• Do You Believe in High End Hardware?

• SQL Server Enterprise Edition (Internal Features)

• SQL Server 2016 Enterprise Edition New Features

• Questions and Answers

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 4: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

What Matters To You?

Manageability Performance Storage Space Disaster Recovery Cost

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 5: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Do You Believe in High End Hardware?

YES

NO

Without High End Software, Your High End Hardware Is Worthless.

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 6: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

SQL Server Internal Features vs. EditionsFeature Enterprise Standard

Advance Scan (Merry-Go-Round)

Fast Recovery

Prefetching

Single Scatter Scan

Automation Matching

Role Reversal

Partitioning

Data Compression

Deferred Transaction

Resource Governor

Vardecimal Storage Formatting

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 7: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Advance Scan (Marry-Go-Round)

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Table A

User A

User B

SQL Server Optimizer Engine

Query Buffer

Query Buffer

Query BufferRead

Page 8: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Fast Recovery

Analysis Phase Redo Phase Undo Phase

Database Recovery Lifecycle

Database is AvailableBy Lock-Logging

Database is Under Recovery Uncommitted Transactionsare Roll-Backed

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 9: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

PrefetchingSelect E.ID, E.FN, E.LN, D.Designation From Employee E Inner Join Designation D On E.Designation_ID = D.ID

Designation

Employee

Read Synchronously

Read Asynchronously

Project Resultset

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 10: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Single Scatter Scan

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

465

308

488

489

Lis

t o

f L

eaf

Pag

es

Page 11: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Automation MatchingCreate Table dbo.Test (ID Bigint, Batch Char(10), BatchID As Cast(ID As Char) + Batch Persisted)

Select ID, Batch From dbo.Test Where Cast ( ID As Char ) + Batch = ‘1045623’

Select ID, Batch From dbo.Test Where BatchID = ‘1045623’

Converts To

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 12: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Role Reversal

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Build Input

Probe Input

Hash MatchResultset

Page 13: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Partitioning

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Dbo.Sales2016-2017Filegroup 1

Dbo.Sales2015-2016Filegroup 2

Dbo.Sales2014-2015Filegroup 3

Query

Dbo.Sales

Page 14: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Data Compression

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

dbo.Sales1 Billion Rows186GB Data Size23,250,000,000,000 Data Pages

dbo.Sales1 Billion Rows108GB Data Size1,4557,760,000 Data Pages

Data Compression Up to 40%

Page 15: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Deferred Transaction

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

In Other Editions, A Corrupted Transaction Causes Database Startup To Fail

Analysis Phase Roll Forward Phase Roll Back Phase

Transaction Recovery Lifecycle

Transaction Uncommitted Transaction Not Rolled BackDue to Corrupted Transaction Log I/O

Page 16: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Resource Governor

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Memory: 64GBProcessor: 8 Logical Processor

DB_AMax Memory: 12GBMax Processor: 2 Logical ProcessorsMax IOPS: 500

DB_BMax Memory: 24GBMax Processor: 4 Logical ProcessorsMax IOPS: 2000

App A

App B

Page 17: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Vardecimal Storage Formatting

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

ID Full Name Savings

1 John Smith 50,000

2 Bill Gates 97,000,000,000

3 Kevin Wood 500

20 Bytes20 Bytes20 Bytes

ID Full Name Savings

1 John Smith 50,000

2 Bill Gates 97,000,000,000

3 Kevin Wood 500

5 Bytes20 Bytes5 Bytes

Page 18: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

SQL SERVER 2016ENTERPRISE EDITION

NEW FEATURES

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 19: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Columnstore Index

• Batch execution for single-threaded queries.

• Snapshot isolation and read-committed snapshot isolation.

• Specify columnstore index when creating a table.

• AlwaysOn readable secondary supports updateable columnstore indexes.

• Updateable nonclustered columnstore index on heap or btree.

• Btree index on a clustered columnstore index.

• Columnstore index on a memory-optimized table. ***

• Nonclustered columnstore index definition supports using a filtered condition.

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 20: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory OLTP• ALTER operations for memory-optimized tables & natively compiled stored

procedures.

• Use MARS connections to access memory-optimized tables and natively compiled stored procedures.

• Support for natively compiled, scalar user-defined functions.

• Complete support for collations (No more limited to code page 1252).

• Memory-Optimized Table size increase to 2TB.

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 21: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

What is In-Memory OLTP?

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

In-Memory Table

Disk Based Table

Benefits:• Eliminate contention.• Reduce logging.• Lower latency data retrieval.• Minimize code execution time.• Efficient data retrieval.• Optional IO reduction or removal, when

using non-durable tables

Implementation Scenarios:• High data insertion rate from multiple

concurrent connections.• Read performance and scale with periodic

batch inserts and updates.• Intensive business logic processing in the

database server.• Low latency.• Session state management.

Page 22: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory OLTP Components

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

In-MemoryPerformance

Page 23: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Memory-Optimized Table Requirements.

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Hardware Software

• X64 Architecture Processor• <60 Processor Cores• Enough Memory (x2 Table Size)• Enough Storage (x2 Table Size)• Processor Needs to Support cmpxchg16b

• X64 Architecture Edition• Enterprise or Developer Edition• Hyper-V to Support cmpxchg16b (If needed)• Enable Instant File Initialization

Page 24: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Memory Optimized Tables.

SQL Server CLR In-Memory Table

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 25: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Memory Optimized Indexes.

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Made for point lookups Made for range scans and ordered scans

Page 26: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory Query Processing

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Disk Based Query Plan SQL Server Query Processing for Disk-Based Tables

INTerpreted Transact-SQL Access to Memory-Optimized TablesMemory Optimized Query Plan

Page 27: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory Query Processing (Cont.)

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Native compilation of stored procedures

Execution of natively compiled stored procedures

Page 28: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory Transactions

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Lifetime of a transaction that accesses memory-optimized tables

Regular Processing Validation Phase Commit Processing

• Commit Dependency• Repeatable Read Validation• Serialization Validation

Page 29: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory Memory EstimationCREATE TABLE IMOLTP (col1 INT NOT NULL PRIMARY KEY NONCLUSTERED,col2 INT NOT NULL INDEX INDEX_1 HASH WITH (BUCKET_COUNT = 5000000),col3 INT NOT NULL INDEX INDEX_2 HASH WITH (BUCKET_COUNT = 5000000),col4 INT NOT NULL INDEX INDEX_3 HASH WITH (BUCKET_COUNT = 5000000),col5 INT NOT NULL INDEX INDEX_4 NONCLUSTERED,col6 CHAR (50) NOT NULL, col7 CHAR (50) NOT NULL, col8 CHAR (30) NOT NULL, col9 CHAR (50) NOT NULL)WITH (MEMORY_OPTIMIZED = ON)

Memory for Table: Timestamps + Index Pointers + Row Data => 24 + (8+8+8+8) + (4+4+4+4+4+50+50+30+50) => 256 x 5000000 => 1.28GB

Memory for Hash Indexes: Round Up Bucket Count x Index Pointer => 223 x 8 => 67,108,864 Bytes => 64MB x 3 => 192MB

Memory for Non-Clustered Index: (Index Pointer + SUM(Key Column Data Type Size)) x Unique Rows => (8 + 4) x 5000000 => 57MB

Memory for Row Versioning: (Longest Trans. Duration in Sec. x Peak No. of Row Updates & Deletes in Sec.) x Row Size=> ( 1 x 10) x 256 => 2560 Bytes => 2560 x (0.3 x 5000000) => 3.66GB

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

http://fard-solutions.com/sql-server-memory-table-size-estimation-script/

Page 30: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory Filegroup Configuration

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 31: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

In-Memory Data & Delta File Population

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 32: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Live Query Statistics

Page 33: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Query Store

Page 34: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Temporal Tables

Page 35: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

JSON Format Query Result

Page 36: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Always Encrypted

Page 37: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Stretch DB

Page 38: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Row Level Security

Page 39: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Dynamic Data Masking

Page 40: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Questions and Answers

Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.

Page 41: SQL Server Enterprise - download.microsoft.com Server...SQL SERVER ENTERPRISE ... •ALTER operations for memory-optimized tables & natively compiled stored ... Regular Processing

Contact for Expert Advice

Copyrights © 2016 Fard Solutions Sdn Bhd, All Rights Reserved.

Fard Solutions Sdn Bhd1-1C, Incubator 1, Technology Park Malaysia, Bukit Jalil, 57000 Kuala Lumpur, Malaysia.

Tel: +603-89946788 - +603-79725433

Web: www.Fard-Solutions.com

Email: [email protected]

Contact Us For 30 Minutes Free Consultation.