# - it’s not about social media it’s about temporary tables and data

Slides:



Advertisements
Similar presentations
new database engine component fully integrated into SQL Server 2014 optimized for OLTP workloads accessing memory resident data achive improvements.
Advertisements

SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312.
SQL Performance 2011/12 Joe Chang, SolidQ
BARBARIN DAVID SQL Server Senior Consultant Pragmantic SA SQL Server Denali : New administration features.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
1099 Why Use InterBase? Bill Todd The Database Group, Inc.
IN-MEMORY OLTP By Manohar Punna SQL Server Geeks – Regional Mentor, Hyderabad Blogger, Speaker.
Ἑ κατόν by Niko Neugebauer. Niko Neugebauer PASS EvangelistPASS Evangelist SQL Server MVPSQL Server MVP SQLPort ( founder & leaderSQLPort.
Alwayson Availability Groups
Module 11: Managing Transactions and Locks
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
# CCNZ What is going on here???
Optimizing SQL Server and Databases for large Fact Tables =tg= Thomas Grohser, NTT Data SQL Server MVP SQL Server Performance Engineering SQL Saturday.
Establishing a Service Level Agreement SLA =tg= Thomas Grohser SQL Server MVP SQL Server Performance Engineering.
Processing Temporal Telemetry Data -aka- Storing BigData in a Small Space =tg= Thomas H. Grohser, SQL Server MVP, Senior Director - Technical Solutions.
Sql Server Architecture for World Domination Tristan Wilson.
Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy.
Session Name Pelin ATICI SQL Premier Field Engineer.
Carlos Bossy Quanta Intelligence SQL Server MCTS, MCITP BI CBIP, Data Mining Real-time Data Warehouse and Reporting Solutions.
Architecting Availability Groups An analysis of Microsoft SQL Server Always-On Availability Group architectures 1.
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
Introducing Hekaton The next step in SQL Server OLTP performance Mladen Prajdić
SQL Server DBA Online TrainingSQL Server DBA Online Training.
Data Warehouse ETL By Garrett EDmondson Thanks to our Gold Sponsors:
SQL Server Statistics and its relationship with Query Optimizer
Turgay Sahtiyan Istanbul, Turkey
Size Matters Not =tg= Thomas Grohser, NTT Data SQL Server MVP
How to tune your applications before moving your database to Microsoft Azure SQL Database (MASD) OK, you've jumped into your Azure journey by creating.
In-Memory Capabilities
Temporal Databases Microsoft SQL Server 2016
Establishing a Service Level Agreement SLA
Optimizing SQL Server and Databases for large Fact Tables
Temporal Databases Microsoft SQL Server 2016
Establishing a Service Level Agreement SLA
Establishing a Service Level Agreement SLA
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Optimizing SQL Server and Databases for large Fact Tables
# - it’s not about social media it’s about temporary tables and data
From SLA to HA/DR solution
Advanced Security Protecting Data from the DBA
Security, Security, Secuirty
Working with Very Large Tables Like a Pro in SQL Server 2014
Real world In-Memory OLTP
Why most candidates fail the interview in the first five minutes
SQL 2014 In-Memory OLTP What, Why, and How
Service Level Agreement
TEMPDB – INTERNALS AND USAGE
The PROCESS of Queries John Deardurff
Shaving of Microseconds
Why most candidates fail the interview in the first minute
Optimizing SQL Server and Databases for large Fact Tables
The PROCESS of Queries John Deardurff Website: ThatAwesomeTrainer.com
Statistics for beginners – In-Memory OLTP
In-Memory OLTP for Database Developers
The PROCESS of Queries John Deardurff
Why most candidates fail the interview in the first five minutes
Transaction Log Internals and Performance David M Maxwell
From SLA to HA/DR solution
Windows Azure Hybrid Architectures and Patterns
Updating Databases With Open SQL
=tg= Thomas Grohser Column Store.
=tg= Thomas Grohser SQL Saturday Philadelphia 2019 TSQL Functions 42.
Why most Candidates fail the Interview in the first five Minutes
Why most Candidates fail the Interview in the first five Minutes
Working with Very Large Tables Like a Pro in SQL Server 2017
42 TSQL Functions =tg= Thomas Grohser SQL Saturday
Updating Databases With Open SQL
Hybrid Buffer Pool The Good, the Bad and the Ugly
Visual Studio and SQL Server Data Tools
Designing Database Solutions for SQL Server
Presentation transcript:

# vs @ - it’s not about social media it’s about temporary tables and data =tg= Thomas Grohser, NTT Data SQL Server MVP SQL Server Performance Engineering Pittsburgh, PA 9/30/2017

select * from =tg= where topic = @@Version Remark SQL 4.21 First SQL Server ever used (1994) SQL 6.0 First Log Shipping with failover SQL 6.5 First SQL Server Cluster (NT4.0 + Wolfpack) SQL 7.0 2+ billion rows / month in a single Table SQL 2000 938 days with 100% availability SQL 2000 IA64 First SQL Server on Itanium IA64 SQL 2005 IA64 First OLTP long distance database mirroring SQL 2008 IA64 First Replication into mirrored databases SQL 2008R2 IA64 SQL 2008R2 x64 First 256 CPUs & >500.000 STMT/sec First Scale out > 1.000.000 STMT/sec First time 1.2+ trillion rows in a table SQL 2012 > 220.000 Transactions per second > 1.3 Trillion Rows in a table SQL 2014 > 400.000 Transactions per second Fully automated deploy and management SQL 2016 AlwaysOn Automatic HA and DR, crossed the PB in storage SQL vNext Can’t wait to push the limits even further =tg= Thomas Grohser, NTT DATA Senior Director Technical Solutions Architecture email: Thomas.grohser@nttdata.com / tg@grohser.com Focus on SQL Server Security, Performance Engineering, Infrastructure and Architecture Wrote some of Close Relationship with SQLCAT (SQL Server Customer Advisory Team) SCAN (SQL Server Customer Advisory Network) TAP (Technology Adoption Program) Product Teams in Redmond Active PASS member and PASS Summit Speaker 23 Years with SQL Server

What is the difference between @ and #? 29 SELECT ASCII('@') - ASCII('#')

Source Temporary Target Repeatable

How to measure performance Time to read source(s) n x sources Time to create temp table 1 x Time to insert into temp table n x sources Time to modify temp table 1 x Time to read temp table n x targets Time to insert into target(s) n x targets

Options for Temporary Tables DECLARE @TableName AS TABLE (…); @Table CREATE #TableName (…); #Table CREATE ##TableName (…); ##Table Use TempDB; CREATE TableName (…); TinTDB CREATE TABLE TableName ( … ) WITH ( MO MEMORY_OPTIMIZED=ON, DURABILITY=SCHEMA_ONLY); CREATE TABLE TableName ( … ) WITH ( MOD DURABILITY=SCHEMA_AND_DATA); Use MyDatabase; CREATE TABLE … UT

Indexes @Table Yes during declaration only DEMO @Table Yes during declaration only #Table Yes (Clustered, Non Clustered, Filtered) ##Table Yes (Clustered, Non Clustered, Filtered) TinTDB Yes (Clustered, Non Clustered, Filtered) MO Yes (Hash and BTree) MOD Yes (Hash and BTree) UT Yes (Clustered, Non Clustered, Filtered, Special)

Scope / Isolation / Durability @Table Current Batch Yes None #Table Current Session Yes None ##Table Global No None TinTDB Global No None MO Global No None MOD Global No Yes UT Global No Yes DEMO

Create Table Triggers Recompilation @Table No #Table Yes ##Table Yes TinTDB Yes MO Yes MOD Yes UT Yes

Statistics @Table No #Table Yes ##Table Yes TinTDB Yes MO Yes MOD Yes UT Yes Cardinality is assumed to be 30% of row count Same problems as with normal tables that update statistics might not be triggered depending on number of rows added/changed Manual Update Statistics can happen

Commit / Rollback supported @Table Yes No #Table Yes Yes ##Table Yes Yes TinTDB Yes Yes MO Yes Yes MOD Yes Yes UT Yes Yes DEMO

Truncate table @Table No #Table Yes ##Table Yes TinTDB Yes MO No (but DELETE is super fast) MOD No (but DELETE is super fast) UT Yes

Transaction Log IO @Table None #Table Reduced (no recovery needed) TinTDB Reduced (no recovery needed) MO None MOD Optimized UT Yes TempDB Your DB

Locking and Blocking @Table No #Table No ##Table Yes TinTDB Yes MO No (retry logic for updates/deletes) MOD No (retry logic for updates/deletes) UT Yes

Performance Read Write @Table Fast Fast #Table Fast OK ##Table Fast OK TinTDB Fast OK MO Fastest Fastest MOD Fastest Very Fast UT Fast Slowest

Create Table Time @Table µs #Table ms ##Table ms TinTDB ms MO seconds MOD seconds UT ms

Alternative Option

CTE – Common Table Expression DEMO WITH tempName AS ( SELECT … ) Do Something with tempName

Summary @Table small datasets in procedures, logging of transaction steps #Table all other cases ##Table sharing temp data between processes TinTDB just don’t do/use it MO staging if source grab is repeatable high frequency MOD staging if source grab is not repeatable UT only is in memory is not available

THANK YOU! and may the force be with you… Questions? thomas.grohser@nttdata.com (9 to 5 5 days a week :-) tg@grohser.com (24x7)