SlideShare a Scribd company logo
1 of 6
SQL Server 2016 –
Some New Features
@anniexu1990
Agenda
• IF EXISTS
• Text Split
• TemporalTables
• Column stored indexes
IF EXISTS
--in versions before 2016
IF OBJECT_ID('[dbo].[V_319AdHocObjects]') IS NOT NULL
BEGIN
DROPVIEW [dbo].[V_319AdHocObjects];
END;
GO
CREATEVIEW [dbo].[V_319AdHocObjects]
AS
SELECT name AS object_name,
SCHEMA_NAME(schema_id) AS schema_name,
x.type_desc
FROM sys.objects x
LEFT JOIN sys.dm_exec_procedure_statsAS d ON
OBJECT_NAME(d.object_id, d.database_id) = name
WHERE SCHEMA_NAME(schema_id) <> 'sys';
--in versions 2016
DROPVIEW IF EXISTS [dbo].[V_319AdHocObjects];
GO
CREATEVIEW [dbo].[V_319AdHocObjects]
AS
SELECT name AS object_name,
SCHEMA_NAME(schema_id) AS schema_name,
x.type_desc
FROM sys.objects x
LEFT JOIN sys.dm_exec_procedure_statsAS d ON
OBJECT_NAME(d.object_id, d.database_id) = name
WHERE SCHEMA_NAME(schema_id) <> 'sys';
TEXT Split
SELECT [ID],
[REPORTING_SEGMENT]
FROM [Ad_Hoc].[dbo].[Service_Requests];
-- use 2016 new scirpt string_split to get number of IDs per reporting_Setment
SELECT value AS reporting_seg,
COUNT([ID])AS countofrequests
FROM [Ad_Hoc].[dbo].[Service_Requests]
CROSS APPLY string_split([REPORTING_SEGMENT], ',')
GROUP BY value;
TemporalTables
USE [Ad_Hoc]
GO
CREATETABLE [dbo].[DataAccuracy_GPM_Temporal](
[ID] int Identity(1,1) Primary Key,
[DataType] [varchar](20) NULL,
[System Name] [varchar](20) NULL,
[Date] [date] NULL,
[Model Field] [nvarchar](255) NULL,
[SourceValue] [money] NULL,
[GPTValue] [money] NULL,
[ModelValue] [decimal](14, 2) NULL
,SysStartTime datetime2GENERATEDALWAYS AS ROW
START HIDDEN NOT NULL
,SysEndTime datetime2GENERATEDALWAYS AS ROW
END HIDDEN NOT NULL
,PERIOD FOR SYSTEM_TIME (SysStartTime,SysEndTime))
WITH (SYSTEM_VERSIONING = ON
(HISTORY_TABLE=dbo.DataAccuracy_GPM_History));
Select [ID]
,[DataType]
,[System Name]
,[Date]
,[Model Field]
,[SourceValue]
,[GPTValue]
,[ModelValue]
,[SysStartTime]
,[SysEndTime]
--ChangeTimezone
--,convert(smalldatetime,[SysStartTime]ATTIME ZONE
'UTC'ATTIME ZONE 'Eastern StandardTime') as
'SystemStartTimeEST'
--,Case when [SysEndTime] = '9999-12-31
23:59:59.9999999' then [SysEndTime]ATTIME ZONE 'UTC'
--ELSE convert(smalldatetime, [SysEndTime]ATTIME
ZONE 'UTC'ATTIME ZONE 'Eastern StandardTime') end as
'SystemEndTimeEST'
from [dbo].[DataAccuracy_GPM_Temporal]
-- For SYSTEM_TIME FROM '2017-06-05 19:12:45.8094962'
to '2017-06-05 19:18:45.8094962'
-- For SYSTEM_TIME CONTAINED IN ( '2017-06-05
19:12:45.8094962', '2017-06-05 19:18:45.8094962')
Columnstore Indexes
--create normal rowstore index
CREATECLUSTERED INDEX [ClusteredIndex-RequestID]ON
[dbo].[Service_Requests_NormalIndex];
GO
--result normal index remember to show plan
SET STATISTICSTIME ON
SELECT [REQ_TYPE]
,count([ID])
FROM [Ad_Hoc].[dbo].[Service_Requests_NormalIndex]
group by [REQ_TYPE];
SET STATISTICSTIME OFF
go
-- create columnstore index
CREATECLUSTERED COLUMNSTORE INDEX [SR_ColumnStoreIndex]
ON Service_Requests_ColumnStoreIndex;
GO
--result
SET STATISTICSTIME ON
SELECT [REQ_TYPE]
,count([ID])
FROM [Ad_Hoc].[dbo].[Service_Requests_ColumnStoreIndex]
group by [REQ_TYPE];
SET STATISTICSTIME OFF
go

More Related Content

Similar to Sql server 2016 – some new features

DNN Database Tips & Tricks
DNN Database Tips & TricksDNN Database Tips & Tricks
DNN Database Tips & TricksWill Strohl
 
Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)Vidyasagar Mundroy
 
supporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tablesupporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tableMahabubur Rahaman
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptxsukrithlal008
 
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfI am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfirshadkumar3
 
Using web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworksUsing web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworksBruno Rocha
 
Designer's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerDesigner's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerKaren Lopez
 
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Julian Hyde
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know Norberto Leite
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)MongoDB
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateKiev ALT.NET
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j
 
When to NoSQL and when to know SQL
When to NoSQL and when to know SQLWhen to NoSQL and when to know SQL
When to NoSQL and when to know SQLSimon Elliston Ball
 
Nko workshop - node js & nosql
Nko workshop - node js & nosqlNko workshop - node js & nosql
Nko workshop - node js & nosqlSimon Su
 

Similar to Sql server 2016 – some new features (20)

DNN Database Tips & Tricks
DNN Database Tips & TricksDNN Database Tips & Tricks
DNN Database Tips & Tricks
 
Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)
 
supporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tablesupporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered table
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
 
SAS Internal Training
SAS Internal TrainingSAS Internal Training
SAS Internal Training
 
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfI am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
 
Using web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworksUsing web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworks
 
Mysql rab2-student
Mysql rab2-studentMysql rab2-student
Mysql rab2-student
 
Mysql rab2-student
Mysql rab2-studentMysql rab2-student
Mysql rab2-student
 
Designer's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerDesigner's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServer
 
Msql
Msql Msql
Msql
 
Polyalgebra
PolyalgebraPolyalgebra
Polyalgebra
 
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data Modelling
 
When to NoSQL and when to know SQL
When to NoSQL and when to know SQLWhen to NoSQL and when to know SQL
When to NoSQL and when to know SQL
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Nko workshop - node js & nosql
Nko workshop - node js & nosqlNko workshop - node js & nosql
Nko workshop - node js & nosql
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Sql server 2016 – some new features

  • 1. SQL Server 2016 – Some New Features @anniexu1990
  • 2. Agenda • IF EXISTS • Text Split • TemporalTables • Column stored indexes
  • 3. IF EXISTS --in versions before 2016 IF OBJECT_ID('[dbo].[V_319AdHocObjects]') IS NOT NULL BEGIN DROPVIEW [dbo].[V_319AdHocObjects]; END; GO CREATEVIEW [dbo].[V_319AdHocObjects] AS SELECT name AS object_name, SCHEMA_NAME(schema_id) AS schema_name, x.type_desc FROM sys.objects x LEFT JOIN sys.dm_exec_procedure_statsAS d ON OBJECT_NAME(d.object_id, d.database_id) = name WHERE SCHEMA_NAME(schema_id) <> 'sys'; --in versions 2016 DROPVIEW IF EXISTS [dbo].[V_319AdHocObjects]; GO CREATEVIEW [dbo].[V_319AdHocObjects] AS SELECT name AS object_name, SCHEMA_NAME(schema_id) AS schema_name, x.type_desc FROM sys.objects x LEFT JOIN sys.dm_exec_procedure_statsAS d ON OBJECT_NAME(d.object_id, d.database_id) = name WHERE SCHEMA_NAME(schema_id) <> 'sys';
  • 4. TEXT Split SELECT [ID], [REPORTING_SEGMENT] FROM [Ad_Hoc].[dbo].[Service_Requests]; -- use 2016 new scirpt string_split to get number of IDs per reporting_Setment SELECT value AS reporting_seg, COUNT([ID])AS countofrequests FROM [Ad_Hoc].[dbo].[Service_Requests] CROSS APPLY string_split([REPORTING_SEGMENT], ',') GROUP BY value;
  • 5. TemporalTables USE [Ad_Hoc] GO CREATETABLE [dbo].[DataAccuracy_GPM_Temporal]( [ID] int Identity(1,1) Primary Key, [DataType] [varchar](20) NULL, [System Name] [varchar](20) NULL, [Date] [date] NULL, [Model Field] [nvarchar](255) NULL, [SourceValue] [money] NULL, [GPTValue] [money] NULL, [ModelValue] [decimal](14, 2) NULL ,SysStartTime datetime2GENERATEDALWAYS AS ROW START HIDDEN NOT NULL ,SysEndTime datetime2GENERATEDALWAYS AS ROW END HIDDEN NOT NULL ,PERIOD FOR SYSTEM_TIME (SysStartTime,SysEndTime)) WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE=dbo.DataAccuracy_GPM_History)); Select [ID] ,[DataType] ,[System Name] ,[Date] ,[Model Field] ,[SourceValue] ,[GPTValue] ,[ModelValue] ,[SysStartTime] ,[SysEndTime] --ChangeTimezone --,convert(smalldatetime,[SysStartTime]ATTIME ZONE 'UTC'ATTIME ZONE 'Eastern StandardTime') as 'SystemStartTimeEST' --,Case when [SysEndTime] = '9999-12-31 23:59:59.9999999' then [SysEndTime]ATTIME ZONE 'UTC' --ELSE convert(smalldatetime, [SysEndTime]ATTIME ZONE 'UTC'ATTIME ZONE 'Eastern StandardTime') end as 'SystemEndTimeEST' from [dbo].[DataAccuracy_GPM_Temporal] -- For SYSTEM_TIME FROM '2017-06-05 19:12:45.8094962' to '2017-06-05 19:18:45.8094962' -- For SYSTEM_TIME CONTAINED IN ( '2017-06-05 19:12:45.8094962', '2017-06-05 19:18:45.8094962')
  • 6. Columnstore Indexes --create normal rowstore index CREATECLUSTERED INDEX [ClusteredIndex-RequestID]ON [dbo].[Service_Requests_NormalIndex]; GO --result normal index remember to show plan SET STATISTICSTIME ON SELECT [REQ_TYPE] ,count([ID]) FROM [Ad_Hoc].[dbo].[Service_Requests_NormalIndex] group by [REQ_TYPE]; SET STATISTICSTIME OFF go -- create columnstore index CREATECLUSTERED COLUMNSTORE INDEX [SR_ColumnStoreIndex] ON Service_Requests_ColumnStoreIndex; GO --result SET STATISTICSTIME ON SELECT [REQ_TYPE] ,count([ID]) FROM [Ad_Hoc].[dbo].[Service_Requests_ColumnStoreIndex] group by [REQ_TYPE]; SET STATISTICSTIME OFF go