尊敬的 微信汇率:1円 ≈ 0.046239 元 支付宝汇率:1円 ≈ 0.04633元 [退出登录]
SlideShare a Scribd company logo
Necessary Evils, Building Optimized
CRUD Procedures
Introduction
Jason
Strate

e: jstrate@pragmaticworks.com
e: jasonstrate@gmail.com
b: www.jasonstrate.com
t: StrateSQL

Resources

jasonstrate.com

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
About Pragmatic Works

•

•
•
•
•

•
•

Industry leaders in Microsoft BI and SQL Server
Platform
SQL Server Professionals - PASS Board of Directors,
Speakers, Authors and MVP’s
National Sales Team Divided by Microsoft
Territories
National System Integrator (NSI)
Gold Certified in Business Intelligence and Data
Platform
Platform Modernization/Safe Passage
Premier Partner for PDW SI Partner Program
MS PDW Partner of Year FY13
Frontline Partnership Partner of the Year for Big Data
Executive sponsor - Andy Mouacdie, WW sales director
PDW

•
•

Over 7,200 customers worldwide
Over 186,000 people in PW database for demand
generation
MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Session Goals
1. Describe the uses for CRUD procedures in
databases
2. Identify the common problems associated with
CRUD procedures
3. Demonstrate methods for writing performant
CRUD procedures

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
What is CRUD?
CREATE, READ, UPDATE, DELETE
•
•
•
•
•
•

ABCD: add, browse, change, delete
BREAD: browse, read, edit, add, delete
QDIM: query, delete, insert, modify
SAID: show, alter, insert, delete
VEDAS: view, edit, delete, add, search
VADE(R): view, add, delete, edit

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Code Generation
• Many tools available:
– T-SQL Script
– Code Smith
– Entity Framework
– LINQ to SQL
– NHibernate

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
CRUD Issues?
• Treat tables as objects
–
–
–

People?
Relationships?
Relationship Type?

• Overly generic
– All columns touched
– One procedure to rule them all

• Performance
– Set versus Singleton
– Index selection
MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Perspectives

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Overview

CREATE, UPDATE, AND DELETE

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
CREATE
CREATE = INSERT
EXEC CRUD.FooInsert
@Column1 = 'Value‘,
@Column2 = 2

INSERT INTO dbo.Foo
(Column1, Column2)
VALUES(@Column1,
@Column2)

Issues:
• Singleton insert
• All columns affected
MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
UPDATE
UPDATE = UPDATE
EXEC CRUD.FooUpdate
@Column1 = 'Value‘,
@Column2 = 2

UPDATE dbo.Foo
SET Column1 = @Column1
WHERE Column2 =
@Column2

Issues:
Singleton update
All columns affected
MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
DELETE
DELETE = DELETE
EXEC CRUD.FooDelete
@Column2 = 2

DELETE FROM dbo.Foo
WHERE Column2 = Column2

Issues:
• Singleton delete

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
T-SQL Features
• Performance
– Table Valued Functions (TVF)
– Table Valued Parameters (TVP)
– XML document
– Merge statement

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Demos

CREATE, UPDATE, AND DELETE

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Overview

READ

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
READ
• READ = SELECT
EXEC CRUD.FooSelect
@Column1 = NULL
,@Column2 = 2

SELECT Column1
,Column2
FROM dbo.Foo
WHERE (@Column1 IS NULL
OR Column1 = @Column1)
AND (@Column2 IS NULL
OR Column2 = @Column2)

Issues
• Index selectivity
MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Demo

READ

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Summary
1. CRUD isn’t necessarily bad
2. Generic templates offer ability to tune and
extend data model behind the scenes.
3. Be cautious in choosing a template for CRUD
4. Know what SQL Server is doing
5. Leverage RECOMPILE as needed

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Learn More About Performance

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
For more information…
Name: Jason Strate
Email: jstrate@pragmaticworks.com
Blog: www.jasonstrate.com

Products
BI products to covert to a Microsoft BI
platform and simplify development on
the platform.

Services
Speed development through training, and
rapid development services from
Pragmatic Works.

Foundation
Helping those who do not have the
means to get into information technology
achieve their dreams.

More Related Content

Similar to Necessary Evils, Building Optimized CRUD Procedures

24 Hours of PASS -- Enterprise Data Mining with SQL Server
24 Hours of PASS -- Enterprise Data Mining with SQL Server24 Hours of PASS -- Enterprise Data Mining with SQL Server
24 Hours of PASS -- Enterprise Data Mining with SQL Server
Mark Tabladillo
 
Mli 2017 business success migrations on m2
Mli 2017 business success migrations on m2Mli 2017 business success migrations on m2
Mli 2017 business success migrations on m2
Hanoi MagentoMeetup
 
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
Bhavani Akunuri
 
Kevin Bengtson Portfolio
Kevin Bengtson PortfolioKevin Bengtson Portfolio
Kevin Bengtson Portfolio
Kbengt521
 
Evolutionary db development
Evolutionary db development Evolutionary db development
Evolutionary db development
Open Party
 
5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events
Jason Strate
 
Office add ins community call-January 2019
Office add ins community call-January 2019Office add ins community call-January 2019
Office add ins community call-January 2019
Microsoft 365 Developer
 
Modernising the way System Customisers Configure the Model-Driven Apps for Us...
Modernising the way System Customisers Configure the Model-Driven Apps for Us...Modernising the way System Customisers Configure the Model-Driven Apps for Us...
Modernising the way System Customisers Configure the Model-Driven Apps for Us...
Linn Zaw Win
 
smrutikanta jena
smrutikanta jenasmrutikanta jena
smrutikanta jena
Smrutikanta Jena
 
VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1
viswa pavan
 
Dynamics gp insights to manufacturing
Dynamics gp insights to manufacturingDynamics gp insights to manufacturing
Dynamics gp insights to manufacturing
Steve Chapman
 
Database Management System - SQL beginner Training
Database Management System - SQL beginner Training Database Management System - SQL beginner Training
Database Management System - SQL beginner Training
Moutasm Tamimi
 
Maximize Big Data ROI via Best of Breed Patterns and Practices
Maximize Big Data ROI via Best of Breed Patterns and PracticesMaximize Big Data ROI via Best of Breed Patterns and Practices
Maximize Big Data ROI via Best of Breed Patterns and Practices
Jeff Bertman
 
JKSQL
JKSQLJKSQL
All Dashboard
All DashboardAll Dashboard
All Dashboard
Amey Patil
 
527759_Resume (5)
527759_Resume (5)527759_Resume (5)
527759_Resume (5)
Dipty Jena
 
Satya\'s Resume
Satya\'s ResumeSatya\'s Resume
Satya\'s Resume
sqlmaster
 
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
NoSQLmatters
 
Crm saturday madrid 2017 3 mosqueteros demian-marco-mario
Crm saturday madrid 2017   3  mosqueteros demian-marco-marioCrm saturday madrid 2017   3  mosqueteros demian-marco-mario
Crm saturday madrid 2017 3 mosqueteros demian-marco-mario
Demian Raschkovan
 
AWS User Group: Building Cloud Analytics Solution with AWS
AWS User Group: Building Cloud Analytics Solution with AWSAWS User Group: Building Cloud Analytics Solution with AWS
AWS User Group: Building Cloud Analytics Solution with AWS
Dmitry Anoshin
 

Similar to Necessary Evils, Building Optimized CRUD Procedures (20)

24 Hours of PASS -- Enterprise Data Mining with SQL Server
24 Hours of PASS -- Enterprise Data Mining with SQL Server24 Hours of PASS -- Enterprise Data Mining with SQL Server
24 Hours of PASS -- Enterprise Data Mining with SQL Server
 
Mli 2017 business success migrations on m2
Mli 2017 business success migrations on m2Mli 2017 business success migrations on m2
Mli 2017 business success migrations on m2
 
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
 
Kevin Bengtson Portfolio
Kevin Bengtson PortfolioKevin Bengtson Portfolio
Kevin Bengtson Portfolio
 
Evolutionary db development
Evolutionary db development Evolutionary db development
Evolutionary db development
 
5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events
 
Office add ins community call-January 2019
Office add ins community call-January 2019Office add ins community call-January 2019
Office add ins community call-January 2019
 
Modernising the way System Customisers Configure the Model-Driven Apps for Us...
Modernising the way System Customisers Configure the Model-Driven Apps for Us...Modernising the way System Customisers Configure the Model-Driven Apps for Us...
Modernising the way System Customisers Configure the Model-Driven Apps for Us...
 
smrutikanta jena
smrutikanta jenasmrutikanta jena
smrutikanta jena
 
VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1
 
Dynamics gp insights to manufacturing
Dynamics gp insights to manufacturingDynamics gp insights to manufacturing
Dynamics gp insights to manufacturing
 
Database Management System - SQL beginner Training
Database Management System - SQL beginner Training Database Management System - SQL beginner Training
Database Management System - SQL beginner Training
 
Maximize Big Data ROI via Best of Breed Patterns and Practices
Maximize Big Data ROI via Best of Breed Patterns and PracticesMaximize Big Data ROI via Best of Breed Patterns and Practices
Maximize Big Data ROI via Best of Breed Patterns and Practices
 
JKSQL
JKSQLJKSQL
JKSQL
 
All Dashboard
All DashboardAll Dashboard
All Dashboard
 
527759_Resume (5)
527759_Resume (5)527759_Resume (5)
527759_Resume (5)
 
Satya\'s Resume
Satya\'s ResumeSatya\'s Resume
Satya\'s Resume
 
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
 
Crm saturday madrid 2017 3 mosqueteros demian-marco-mario
Crm saturday madrid 2017   3  mosqueteros demian-marco-marioCrm saturday madrid 2017   3  mosqueteros demian-marco-mario
Crm saturday madrid 2017 3 mosqueteros demian-marco-mario
 
AWS User Group: Building Cloud Analytics Solution with AWS
AWS User Group: Building Cloud Analytics Solution with AWSAWS User Group: Building Cloud Analytics Solution with AWS
AWS User Group: Building Cloud Analytics Solution with AWS
 

More from Jason Strate

Accelerating Business Intelligence Solutions with Microsoft Azure pass
Accelerating Business Intelligence Solutions with Microsoft Azure   passAccelerating Business Intelligence Solutions with Microsoft Azure   pass
Accelerating Business Intelligence Solutions with Microsoft Azure pass
Jason Strate
 
The Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL ServerThe Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL Server
Jason Strate
 
Strategies for SQL Server Index Analysis
Strategies for SQL Server Index AnalysisStrategies for SQL Server Index Analysis
Strategies for SQL Server Index Analysis
Jason Strate
 
5 SQL Server Indexing Myths
5 SQL Server Indexing Myths5 SQL Server Indexing Myths
5 SQL Server Indexing Myths
Jason Strate
 
Introduction to Columnstore Indexes
Introduction to Columnstore IndexesIntroduction to Columnstore Indexes
Introduction to Columnstore Indexes
Jason Strate
 
Choosing Your Clustered Index
Choosing Your Clustered IndexChoosing Your Clustered Index
Choosing Your Clustered Index
Jason Strate
 
BuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended EventsBuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended Events
Jason Strate
 
5 ways to improve performance through indexing
5 ways to improve performance through indexing5 ways to improve performance through indexing
5 ways to improve performance through indexing
Jason Strate
 
The Side Effect of NOLOCK
The Side Effect of NOLOCKThe Side Effect of NOLOCK
The Side Effect of NOLOCK
Jason Strate
 
Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)
Jason Strate
 
Introduction to SQL Server Security
Introduction to SQL Server SecurityIntroduction to SQL Server Security
Introduction to SQL Server Security
Jason Strate
 
What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)
Jason Strate
 
Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)
Jason Strate
 
Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)
Jason Strate
 
A Function by Any Other Name is a Function
A Function by Any Other Name is a FunctionA Function by Any Other Name is a Function
A Function by Any Other Name is a Function
Jason Strate
 
What are you waiting for
What are you waiting forWhat are you waiting for
What are you waiting for
Jason Strate
 

More from Jason Strate (16)

Accelerating Business Intelligence Solutions with Microsoft Azure pass
Accelerating Business Intelligence Solutions with Microsoft Azure   passAccelerating Business Intelligence Solutions with Microsoft Azure   pass
Accelerating Business Intelligence Solutions with Microsoft Azure pass
 
The Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL ServerThe Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL Server
 
Strategies for SQL Server Index Analysis
Strategies for SQL Server Index AnalysisStrategies for SQL Server Index Analysis
Strategies for SQL Server Index Analysis
 
5 SQL Server Indexing Myths
5 SQL Server Indexing Myths5 SQL Server Indexing Myths
5 SQL Server Indexing Myths
 
Introduction to Columnstore Indexes
Introduction to Columnstore IndexesIntroduction to Columnstore Indexes
Introduction to Columnstore Indexes
 
Choosing Your Clustered Index
Choosing Your Clustered IndexChoosing Your Clustered Index
Choosing Your Clustered Index
 
BuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended EventsBuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended Events
 
5 ways to improve performance through indexing
5 ways to improve performance through indexing5 ways to improve performance through indexing
5 ways to improve performance through indexing
 
The Side Effect of NOLOCK
The Side Effect of NOLOCKThe Side Effect of NOLOCK
The Side Effect of NOLOCK
 
Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)
 
Introduction to SQL Server Security
Introduction to SQL Server SecurityIntroduction to SQL Server Security
Introduction to SQL Server Security
 
What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)What are you waiting for? (#SQLSat211)
What are you waiting for? (#SQLSat211)
 
Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)
 
Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)
 
A Function by Any Other Name is a Function
A Function by Any Other Name is a FunctionA Function by Any Other Name is a Function
A Function by Any Other Name is a Function
 
What are you waiting for
What are you waiting forWhat are you waiting for
What are you waiting for
 

Recently uploaded

QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Day 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data ManipulationDay 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data Manipulation
UiPathCommunity
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
ScyllaDB
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
ScyllaDB
 
From NCSA to the National Research Platform
From NCSA to the National Research PlatformFrom NCSA to the National Research Platform
From NCSA to the National Research Platform
Larry Smarr
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
manji sharman06
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Mydbops
 

Recently uploaded (20)

QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Day 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data ManipulationDay 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data Manipulation
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
 
From NCSA to the National Research Platform
From NCSA to the National Research PlatformFrom NCSA to the National Research Platform
From NCSA to the National Research Platform
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
 

Necessary Evils, Building Optimized CRUD Procedures

  • 1. Necessary Evils, Building Optimized CRUD Procedures
  • 2. Introduction Jason Strate e: jstrate@pragmaticworks.com e: jasonstrate@gmail.com b: www.jasonstrate.com t: StrateSQL Resources jasonstrate.com MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 3. About Pragmatic Works • • • • • • • Industry leaders in Microsoft BI and SQL Server Platform SQL Server Professionals - PASS Board of Directors, Speakers, Authors and MVP’s National Sales Team Divided by Microsoft Territories National System Integrator (NSI) Gold Certified in Business Intelligence and Data Platform Platform Modernization/Safe Passage Premier Partner for PDW SI Partner Program MS PDW Partner of Year FY13 Frontline Partnership Partner of the Year for Big Data Executive sponsor - Andy Mouacdie, WW sales director PDW • • Over 7,200 customers worldwide Over 186,000 people in PW database for demand generation MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 4. Session Goals 1. Describe the uses for CRUD procedures in databases 2. Identify the common problems associated with CRUD procedures 3. Demonstrate methods for writing performant CRUD procedures MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 5. What is CRUD? CREATE, READ, UPDATE, DELETE • • • • • • ABCD: add, browse, change, delete BREAD: browse, read, edit, add, delete QDIM: query, delete, insert, modify SAID: show, alter, insert, delete VEDAS: view, edit, delete, add, search VADE(R): view, add, delete, edit MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 6. Code Generation • Many tools available: – T-SQL Script – Code Smith – Entity Framework – LINQ to SQL – NHibernate MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 7. CRUD Issues? • Treat tables as objects – – – People? Relationships? Relationship Type? • Overly generic – All columns touched – One procedure to rule them all • Performance – Set versus Singleton – Index selection MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 9. Overview CREATE, UPDATE, AND DELETE MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 10. CREATE CREATE = INSERT EXEC CRUD.FooInsert @Column1 = 'Value‘, @Column2 = 2 INSERT INTO dbo.Foo (Column1, Column2) VALUES(@Column1, @Column2) Issues: • Singleton insert • All columns affected MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 11. UPDATE UPDATE = UPDATE EXEC CRUD.FooUpdate @Column1 = 'Value‘, @Column2 = 2 UPDATE dbo.Foo SET Column1 = @Column1 WHERE Column2 = @Column2 Issues: Singleton update All columns affected MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 12. DELETE DELETE = DELETE EXEC CRUD.FooDelete @Column2 = 2 DELETE FROM dbo.Foo WHERE Column2 = Column2 Issues: • Singleton delete MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 13. T-SQL Features • Performance – Table Valued Functions (TVF) – Table Valued Parameters (TVP) – XML document – Merge statement MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 14. Demos CREATE, UPDATE, AND DELETE MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 16. READ • READ = SELECT EXEC CRUD.FooSelect @Column1 = NULL ,@Column2 = 2 SELECT Column1 ,Column2 FROM dbo.Foo WHERE (@Column1 IS NULL OR Column1 = @Column1) AND (@Column2 IS NULL OR Column2 = @Column2) Issues • Index selectivity MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 18. Summary 1. CRUD isn’t necessarily bad 2. Generic templates offer ability to tune and extend data model behind the scenes. 3. Be cautious in choosing a template for CRUD 4. Know what SQL Server is doing 5. Leverage RECOMPILE as needed MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 19. Learn More About Performance MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 20. For more information… Name: Jason Strate Email: jstrate@pragmaticworks.com Blog: www.jasonstrate.com Products BI products to covert to a Microsoft BI platform and simplify development on the platform. Services Speed development through training, and rapid development services from Pragmatic Works. Foundation Helping those who do not have the means to get into information technology achieve their dreams.
  翻译: