SlideShare a Scribd company logo
1 of 35
Agenda
• Learn how your application can benefit from new query
processing capabilities in the Azure SQL Database and SQL Server
platform
• Graph data processing to model complex relationships between
objects
• Advanced self-tuning query processing to solve or avoid performance
related problems
What is a Graph Database?
Bob
USB
Flash
Drive
White
Chocolate
FriendOf
Bought
Bought
Furry
Socks
City
from
Bought
Mary
Our approach – Embrace and Extend
Backed by Research
References
J. Fan, A. Gerald, S. Raj and J. M. Patel,
"The case against specialized graph
analytics engines," in CIDR, Asilomar, CA,
2015.
A. Jindal, S. Madden, M. Castellanos and
M. Hsu, "Graph analytics using vertica
relational database," in IEEE BigData,
Santa Clara, CA, 2015
Matured Product
40+ years of academic and
industry research.
Highly evolved ecosystem,
including tooling and
community support
Build on-prem, cloud,
Hybrid Solutions
Best of both relational
and graph database on a
single platform
Trusted
Used and trusted by
millions of customers for
enterprise and mission
critical workloads.
SQL Server 2017 – Graph Extensions
Integrated into the SQL Engine
•
•
•
•
•
DDL Extensions: CREATE NODE
CREATE TABLE Customers (
[CustomerID] INTEGER NOT NULL,
[CustomerName] NVARCHAR(100) NOT NULL,
[WebsiteURL] NVARCHAR(256) NOT NULL
) AS NODE
GO
SELECT TOP 5 * FROM Customers;
DDL Extensions: CREATE EDGE
CREATE TABLE Bought (
[PurchasedCount] BIGINT
) AS EDGE;
GO
CREATE TABLE FriendOf AS EDGE
GO
SELECT TOP 5 * FROM Bought;
Inserting data into graph tables
INSERT INTO Customers(CustomerName, …)
SELECT CustomerName, …
FROM WideWorldImporters.Sales.Customers
GO
INSERT INTO Bought($from_id, $to_id, PurchasedCount)
SELECT Customers.$node_id, StockItems.$node_id, @purchasecount
FROM Customers, StockItems
WHERE Customers.CustomerID = @customer_id
AND StockItems.StockItemID = @stockitem_id
GO
Query Language Extensions: MATCH
SELECT
CustomerName,
StockItemName
FROM
StockItems,
Customers,
Bought
WHERE MATCH(Customers-(Bought)->StockItems)
AND StockItemName = 'White chocolate snow balls 250g'
Product Recommendations
Customer
StockItem
Bought
Supplier
SuppliedBy
From
Location
From
FriendOf
Product Recommendations (“Before”)
WITH Current_Usr AS
(
SELECT
CustomerID = 88,
StockItemID = 226, -- 'White chocolate snow balls 250g'
PurchasedCount = 1
) ,
-- Identify the other users who have also purchased the item he/she is
looking for
Other_Usr AS
(
SELECT
C.CustomerID,
P.StockItemID,
Purchased_by_others = COUNT(*)
FROM
Sales.OrderLines AS OD
JOIN
Sales.Orders AS OH ON OH.OrderID=OD.OrderID
JOIN
Sales.Customers AS C ON OH.CustomerID=C.CustomerID
JOIN
Current_Usr AS P ON P.StockItemID=OD.StockItemID
WHERE
C.CustomerID<>P.CustomerID
GROUP BY
C.CustomerID, P.StockItemID
) ,
-- Find the other items which those other customers have also purchased
Other_Items AS
(
SELECT
C.CustomerID,
P.StockItemID,
Other_purchased = COUNT(*)
FROM
Sales.OrderLines AS OD
JOIN
Sales.Orders AS OH ON OH.OrderID=OD.OrderID
JOIN
Other_Usr AS C ON OH.CustomerID=C.CustomerID
JOIN
Warehouse.StockItems AS P ON P.StockItemID=OD.StockItemID
WHERE
P.StockItemName<>'White chocolate snow balls 250g'
GROUP BY
C.CustomerID, P.StockItemID
)
-- Outer query
-- Recommend to the current user to the top items from those other items,
-- ordered by the number of times they were purchased
SELECT
top 10 P.StockItemName,
COUNT(Other_purchased)
FROM
Other_Items
JOIN
Warehouse.StockItems AS P ON P.StockItemID=Other_Items.StockItemID
GROUP BY
P.StockItemName
ORDER BY
COUNT(Other_purchased) DESC;
GO
SELECT
TOP 10 RecommendedItem.StockItemName,
COUNT(*)
FROM
StockItems AS Item,
Customers AS C,
Bought AS BoughtOther,
Bought AS BoughtThis,
StockItems AS RecommendedItem
WHERE
MATCH(RecommendedItem<-(BoughtOther)-C-(BoughtThis)->Item)
AND Item.StockItemName LIKE 'White chocolate snow balls 250g’
AND (Item.StockItemName <> RecommendedItem.StockItemName)
AND C.customerID <> 88
GROUP BY
RecommendedItem.StockItemName
ORDER BY COUNT(*) DESC;
GO
Product Recommendations with SQL Graph (“After”)
SELECT
TOP 10 RecommendedItem.StockItemName,
COUNT(*)
FROM
StockItems AS Item,
Customers AS C,
Bought AS BoughtOther,
Bought AS BoughtThis,
StockItems AS RecommendedItem
WHERE
Item.StockItemName LIKE 'White chocolate snow balls 250g'
AND MATCH(RecommendedItem<-(BoughtOther)-C-(BoughtThis)->Item)
AND (Item.StockItemName <> RecommendedItem.StockItemName)
and C.customerID <> 88
GROUP BY
RecommendedItem.StockItemName
ORDER BY COUNT(*) DESC;
GO
Product Recommendations with SQL Graph (“After”)
Design Choices
• Relational vs. Graph
 Graph and relational
designs can answer
similar questions
 But if traversal of
relationships define the
primary application
requirements, Graph can
solve this more intuitively
and with less code
 Recommendation
Systems
 Fraud Detection
 Content Management
 Bill of Materials,
product hierarchy
 CRM
Adaptive Query
Processing
Interleaved Execution
for MSTVFs
Batch Mode Memory
Grant Feedback
Batch Mode
Adaptive Joins
?...
Query
•The query
text is parsed
in a logical
tree
Transformations
•QO comes up
with equivalent
variations of
the tree
Cardinality
Estimation (CE)
•CE estimates
number of
rows flowing
through each
operator in
each tree
Costing
•Based on the
CE, each
equivalent tree
gets a cost.
The cheapest
one is the
winner.
Plan Cache
•The plan is
cached for re-
use by queries
with the same
text
Query
•Same query is
executed
Plan Cache
•The previously
cached plan is
retrieved
Memory, DOP
•Based on the
CE in the final
plan, memory
grant is
acquired
Query
Execution
•The query
starts
executing
according to
the plan
Query
Execution
(QE)
What could go wrong?
Query
Optimization
(QO)
Missing statistics Stale statistics
Inadequate
statistics sample
rate
Bad parameter
sniffing scenarios
Out-of-model
query constructs
• E.g. Multi-Statement
TVFs, table
variables, XQuery
Assumptions not
aligned with data
being queried
• E.g. independence
vs. correlation
Slow query
response time due
to inefficient plans
Excessive resource
utilization (CPU,
Memory, IO)
Spills to disk
Reduced
throughput and
concurrency
T-SQL refactoring
to work around off-
model statements
Problem: Multi-statement table
valued functions (MSTVFs) are
treated as a black box by QP
and we use a fixed optimization
guess
Interleaved Execution will
materialize and use row counts
for MSTVFs
Downstream operations will
benefit from the corrected
MSTVF cardinality estimate
Problem: Queries may spill to disk or
take too much memory based on poor
cardinality estimates
MGF will adjust memory grants based
on execution feedback
MGF will remove spills and improve
concurrency for repeating queries
Problem: If cardinality estimates are
skewed, we may choose an
inappropriate join algorithm
Adaptive Join will defer the choice of
hash join or nested loop until after the
first join input has been scanned
Adaptive Join uses nested loop for small
inputs, hash joins for large inputs
1 50,000
Cost
Rows
Adaptive Join Threshold
Hash Join Nested Loop Join
Better performance with Automatic Plan Correction
Automatically fix
problems without
tuning
Better Performance with
Automatic Tuning
Continuous performance plan monitoring
and analysis
Detect problematic plans
Automatically fix performance problems
caused by SQL plan choice regressions
Querytimes
Plan 1 Plan 2 Plan 3 Plan 2
Revert to previously
effective plan
• dm_db_tuning_recommendations
Detect
• and system corrects
Turn on Auto
• to “last known good”
Reverts back
Can be helpful for parameter
sniffing situations
Automatic Tuning
Intelligent QP
Adaptive QP
Interleaved
Execution
Memory Grant
Feedback
Batch Mode?
Batch Mode
Adaptive Joins
? ? ? ?
Interested in testing new QP features? Email IntelligentQP@microsoft.com
SQL Graph Overview
SQL Graph Architechture
About SQL Graph
Bulk Insert Best Practices
Recommendation System on Million Song Dataset
Product Recommendations in WideWorldImporters using SQL Graph
Recursive Queries and Shortest Path
Shortest Path on Yelp Dataset
https://aka.ms/SQLAQP
https://aka.ms/SQLAQPdemos
https://aka.ms/sqlengineblog
Query Processing Innovations for data intensive, modern applications
Query Processing Innovations for data intensive, modern applications

More Related Content

Similar to Query Processing Innovations for data intensive, modern applications

Why Your Data Science Architecture Should Include a Data Virtualization Tool ...
Why Your Data Science Architecture Should Include a Data Virtualization Tool ...Why Your Data Science Architecture Should Include a Data Virtualization Tool ...
Why Your Data Science Architecture Should Include a Data Virtualization Tool ...Denodo
 
Overview of Business Intelligence
Overview of Business IntelligenceOverview of Business Intelligence
Overview of Business IntelligenceParthiv Dixit
 
Introduction to data mining and data warehousing
Introduction to data mining and data warehousingIntroduction to data mining and data warehousing
Introduction to data mining and data warehousingEr. Nawaraj Bhandari
 
Splunk Business Analytics
Splunk Business AnalyticsSplunk Business Analytics
Splunk Business AnalyticsCleverDATA
 
Dw Concepts
Dw ConceptsDw Concepts
Dw Conceptsdataware
 
351315535-Module-1-Intro-to-Data-Science-pptx.pptx
351315535-Module-1-Intro-to-Data-Science-pptx.pptx351315535-Module-1-Intro-to-Data-Science-pptx.pptx
351315535-Module-1-Intro-to-Data-Science-pptx.pptxXanGwaps
 
2018 data warehouse features in spark
2018   data warehouse features in spark2018   data warehouse features in spark
2018 data warehouse features in sparkChester Chen
 
Predictive Analytics - Big Data Warehousing Meetup
Predictive Analytics - Big Data Warehousing MeetupPredictive Analytics - Big Data Warehousing Meetup
Predictive Analytics - Big Data Warehousing MeetupCaserta
 
Big Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft AzureBig Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft AzureMark Kromer
 
finalestkddfinalpresentation-111207021040-phpapp01.pptx
finalestkddfinalpresentation-111207021040-phpapp01.pptxfinalestkddfinalpresentation-111207021040-phpapp01.pptx
finalestkddfinalpresentation-111207021040-phpapp01.pptxshumPanwar
 
Self-serve analytics journey at Celtra: Snowflake, Spark, and Databricks
Self-serve analytics journey at Celtra: Snowflake, Spark, and DatabricksSelf-serve analytics journey at Celtra: Snowflake, Spark, and Databricks
Self-serve analytics journey at Celtra: Snowflake, Spark, and DatabricksGrega Kespret
 
Datawarehousing
DatawarehousingDatawarehousing
Datawarehousingwork
 
What is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ NewyorksysWhat is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ NewyorksysNEWYORKSYS-IT SOLUTIONS
 
Data quality in decision making - Dr. Philip Woodall, University of Cambridge
Data quality in decision making - Dr. Philip Woodall, University of CambridgeData quality in decision making - Dr. Philip Woodall, University of Cambridge
Data quality in decision making - Dr. Philip Woodall, University of CambridgeBCS Data Management Specialist Group
 
Partner Enablement: Key Differentiators of Denodo Platform 6.0 for the Field
Partner Enablement: Key Differentiators of Denodo Platform 6.0 for the FieldPartner Enablement: Key Differentiators of Denodo Platform 6.0 for the Field
Partner Enablement: Key Differentiators of Denodo Platform 6.0 for the FieldDenodo
 
Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...
Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...
Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...ClearStory Data
 
Unifying your data management with Hadoop
Unifying your data management with HadoopUnifying your data management with Hadoop
Unifying your data management with HadoopJayant Shekhar
 
OSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdf
OSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdfOSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdf
OSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdfAltinity Ltd
 

Similar to Query Processing Innovations for data intensive, modern applications (20)

Why Your Data Science Architecture Should Include a Data Virtualization Tool ...
Why Your Data Science Architecture Should Include a Data Virtualization Tool ...Why Your Data Science Architecture Should Include a Data Virtualization Tool ...
Why Your Data Science Architecture Should Include a Data Virtualization Tool ...
 
ITReady DW Day2
ITReady DW Day2ITReady DW Day2
ITReady DW Day2
 
Overview of Business Intelligence
Overview of Business IntelligenceOverview of Business Intelligence
Overview of Business Intelligence
 
Introduction to data mining and data warehousing
Introduction to data mining and data warehousingIntroduction to data mining and data warehousing
Introduction to data mining and data warehousing
 
Splunk Business Analytics
Splunk Business AnalyticsSplunk Business Analytics
Splunk Business Analytics
 
Dw Concepts
Dw ConceptsDw Concepts
Dw Concepts
 
351315535-Module-1-Intro-to-Data-Science-pptx.pptx
351315535-Module-1-Intro-to-Data-Science-pptx.pptx351315535-Module-1-Intro-to-Data-Science-pptx.pptx
351315535-Module-1-Intro-to-Data-Science-pptx.pptx
 
2018 data warehouse features in spark
2018   data warehouse features in spark2018   data warehouse features in spark
2018 data warehouse features in spark
 
Predictive Analytics - Big Data Warehousing Meetup
Predictive Analytics - Big Data Warehousing MeetupPredictive Analytics - Big Data Warehousing Meetup
Predictive Analytics - Big Data Warehousing Meetup
 
Big Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft AzureBig Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft Azure
 
finalestkddfinalpresentation-111207021040-phpapp01.pptx
finalestkddfinalpresentation-111207021040-phpapp01.pptxfinalestkddfinalpresentation-111207021040-phpapp01.pptx
finalestkddfinalpresentation-111207021040-phpapp01.pptx
 
Self-serve analytics journey at Celtra: Snowflake, Spark, and Databricks
Self-serve analytics journey at Celtra: Snowflake, Spark, and DatabricksSelf-serve analytics journey at Celtra: Snowflake, Spark, and Databricks
Self-serve analytics journey at Celtra: Snowflake, Spark, and Databricks
 
Datawarehousing
DatawarehousingDatawarehousing
Datawarehousing
 
What is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ NewyorksysWhat is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
What is OLAP -Data Warehouse Concepts - IT Online Training @ Newyorksys
 
Data quality in decision making - Dr. Philip Woodall, University of Cambridge
Data quality in decision making - Dr. Philip Woodall, University of CambridgeData quality in decision making - Dr. Philip Woodall, University of Cambridge
Data quality in decision making - Dr. Philip Woodall, University of Cambridge
 
Partner Enablement: Key Differentiators of Denodo Platform 6.0 for the Field
Partner Enablement: Key Differentiators of Denodo Platform 6.0 for the FieldPartner Enablement: Key Differentiators of Denodo Platform 6.0 for the Field
Partner Enablement: Key Differentiators of Denodo Platform 6.0 for the Field
 
Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...
Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...
Fast Cycle, Multi-Terabyte Data Analysis with Amazon Redshift and ClearStory ...
 
Skilwise Big data
Skilwise Big dataSkilwise Big data
Skilwise Big data
 
Unifying your data management with Hadoop
Unifying your data management with HadoopUnifying your data management with Hadoop
Unifying your data management with Hadoop
 
OSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdf
OSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdfOSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdf
OSA Con 2022 - Scaling your Pandas Analytics with Modin - Doris Lee - Ponder.pdf
 

More from Microsoft Tech Community

Removing Security Roadblocks to IoT Deployment Success
Removing Security Roadblocks to IoT Deployment SuccessRemoving Security Roadblocks to IoT Deployment Success
Removing Security Roadblocks to IoT Deployment SuccessMicrosoft Tech Community
 
Building mobile apps with Visual Studio and Xamarin
Building mobile apps with Visual Studio and XamarinBuilding mobile apps with Visual Studio and Xamarin
Building mobile apps with Visual Studio and XamarinMicrosoft Tech Community
 
Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...Microsoft Tech Community
 
Interactive emails in Outlook with Adaptive Cards
Interactive emails in Outlook with Adaptive CardsInteractive emails in Outlook with Adaptive Cards
Interactive emails in Outlook with Adaptive CardsMicrosoft Tech Community
 
Unlocking security insights with Microsoft Graph API
Unlocking security insights with Microsoft Graph APIUnlocking security insights with Microsoft Graph API
Unlocking security insights with Microsoft Graph APIMicrosoft Tech Community
 
Break through the serverless barriers with Durable Functions
Break through the serverless barriers with Durable FunctionsBreak through the serverless barriers with Durable Functions
Break through the serverless barriers with Durable FunctionsMicrosoft Tech Community
 
Multiplayer Server Scaling with Azure Container Instances
Multiplayer Server Scaling with Azure Container InstancesMultiplayer Server Scaling with Azure Container Instances
Multiplayer Server Scaling with Azure Container InstancesMicrosoft Tech Community
 
Media Streaming Apps with Azure and Xamarin
Media Streaming Apps with Azure and XamarinMedia Streaming Apps with Azure and Xamarin
Media Streaming Apps with Azure and XamarinMicrosoft Tech Community
 
Real-World Solutions with PowerApps: Tips & tricks to manage your app complexity
Real-World Solutions with PowerApps: Tips & tricks to manage your app complexityReal-World Solutions with PowerApps: Tips & tricks to manage your app complexity
Real-World Solutions with PowerApps: Tips & tricks to manage your app complexityMicrosoft Tech Community
 
Ingestion in data pipelines with Managed Kafka Clusters in Azure HDInsight
Ingestion in data pipelines with Managed Kafka Clusters in Azure HDInsightIngestion in data pipelines with Managed Kafka Clusters in Azure HDInsight
Ingestion in data pipelines with Managed Kafka Clusters in Azure HDInsightMicrosoft Tech Community
 
Getting Started with Visual Studio Tools for AI
Getting Started with Visual Studio Tools for AIGetting Started with Visual Studio Tools for AI
Getting Started with Visual Studio Tools for AIMicrosoft Tech Community
 
Mobile Workforce Location Tracking with Bing Maps
Mobile Workforce Location Tracking with Bing MapsMobile Workforce Location Tracking with Bing Maps
Mobile Workforce Location Tracking with Bing MapsMicrosoft Tech Community
 
Cognitive Services Labs in action Anomaly detection
Cognitive Services Labs in action Anomaly detectionCognitive Services Labs in action Anomaly detection
Cognitive Services Labs in action Anomaly detectionMicrosoft Tech Community
 

More from Microsoft Tech Community (20)

100 ways to use Yammer
100 ways to use Yammer100 ways to use Yammer
100 ways to use Yammer
 
10 Yammer Group Suggestions
10 Yammer Group Suggestions10 Yammer Group Suggestions
10 Yammer Group Suggestions
 
Removing Security Roadblocks to IoT Deployment Success
Removing Security Roadblocks to IoT Deployment SuccessRemoving Security Roadblocks to IoT Deployment Success
Removing Security Roadblocks to IoT Deployment Success
 
Building mobile apps with Visual Studio and Xamarin
Building mobile apps with Visual Studio and XamarinBuilding mobile apps with Visual Studio and Xamarin
Building mobile apps with Visual Studio and Xamarin
 
Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...
 
Interactive emails in Outlook with Adaptive Cards
Interactive emails in Outlook with Adaptive CardsInteractive emails in Outlook with Adaptive Cards
Interactive emails in Outlook with Adaptive Cards
 
Unlocking security insights with Microsoft Graph API
Unlocking security insights with Microsoft Graph APIUnlocking security insights with Microsoft Graph API
Unlocking security insights with Microsoft Graph API
 
Break through the serverless barriers with Durable Functions
Break through the serverless barriers with Durable FunctionsBreak through the serverless barriers with Durable Functions
Break through the serverless barriers with Durable Functions
 
Multiplayer Server Scaling with Azure Container Instances
Multiplayer Server Scaling with Azure Container InstancesMultiplayer Server Scaling with Azure Container Instances
Multiplayer Server Scaling with Azure Container Instances
 
Explore Azure Cosmos DB
Explore Azure Cosmos DBExplore Azure Cosmos DB
Explore Azure Cosmos DB
 
Media Streaming Apps with Azure and Xamarin
Media Streaming Apps with Azure and XamarinMedia Streaming Apps with Azure and Xamarin
Media Streaming Apps with Azure and Xamarin
 
DevOps for Data Science
DevOps for Data ScienceDevOps for Data Science
DevOps for Data Science
 
Real-World Solutions with PowerApps: Tips & tricks to manage your app complexity
Real-World Solutions with PowerApps: Tips & tricks to manage your app complexityReal-World Solutions with PowerApps: Tips & tricks to manage your app complexity
Real-World Solutions with PowerApps: Tips & tricks to manage your app complexity
 
Azure Functions and Microsoft Graph
Azure Functions and Microsoft GraphAzure Functions and Microsoft Graph
Azure Functions and Microsoft Graph
 
Ingestion in data pipelines with Managed Kafka Clusters in Azure HDInsight
Ingestion in data pipelines with Managed Kafka Clusters in Azure HDInsightIngestion in data pipelines with Managed Kafka Clusters in Azure HDInsight
Ingestion in data pipelines with Managed Kafka Clusters in Azure HDInsight
 
Getting Started with Visual Studio Tools for AI
Getting Started with Visual Studio Tools for AIGetting Started with Visual Studio Tools for AI
Getting Started with Visual Studio Tools for AI
 
Using AML Python SDK
Using AML Python SDKUsing AML Python SDK
Using AML Python SDK
 
Mobile Workforce Location Tracking with Bing Maps
Mobile Workforce Location Tracking with Bing MapsMobile Workforce Location Tracking with Bing Maps
Mobile Workforce Location Tracking with Bing Maps
 
Cognitive Services Labs in action Anomaly detection
Cognitive Services Labs in action Anomaly detectionCognitive Services Labs in action Anomaly detection
Cognitive Services Labs in action Anomaly detection
 
Speech Devices SDK
Speech Devices SDKSpeech Devices SDK
Speech Devices SDK
 

Recently uploaded

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Query Processing Innovations for data intensive, modern applications

  • 1.
  • 2.
  • 3. Agenda • Learn how your application can benefit from new query processing capabilities in the Azure SQL Database and SQL Server platform • Graph data processing to model complex relationships between objects • Advanced self-tuning query processing to solve or avoid performance related problems
  • 4.
  • 5. What is a Graph Database? Bob USB Flash Drive White Chocolate FriendOf Bought Bought Furry Socks City from Bought Mary
  • 6. Our approach – Embrace and Extend Backed by Research References J. Fan, A. Gerald, S. Raj and J. M. Patel, "The case against specialized graph analytics engines," in CIDR, Asilomar, CA, 2015. A. Jindal, S. Madden, M. Castellanos and M. Hsu, "Graph analytics using vertica relational database," in IEEE BigData, Santa Clara, CA, 2015 Matured Product 40+ years of academic and industry research. Highly evolved ecosystem, including tooling and community support Build on-prem, cloud, Hybrid Solutions Best of both relational and graph database on a single platform Trusted Used and trusted by millions of customers for enterprise and mission critical workloads.
  • 7. SQL Server 2017 – Graph Extensions
  • 8. Integrated into the SQL Engine • • • • •
  • 9. DDL Extensions: CREATE NODE CREATE TABLE Customers ( [CustomerID] INTEGER NOT NULL, [CustomerName] NVARCHAR(100) NOT NULL, [WebsiteURL] NVARCHAR(256) NOT NULL ) AS NODE GO SELECT TOP 5 * FROM Customers;
  • 10. DDL Extensions: CREATE EDGE CREATE TABLE Bought ( [PurchasedCount] BIGINT ) AS EDGE; GO CREATE TABLE FriendOf AS EDGE GO SELECT TOP 5 * FROM Bought;
  • 11. Inserting data into graph tables INSERT INTO Customers(CustomerName, …) SELECT CustomerName, … FROM WideWorldImporters.Sales.Customers GO INSERT INTO Bought($from_id, $to_id, PurchasedCount) SELECT Customers.$node_id, StockItems.$node_id, @purchasecount FROM Customers, StockItems WHERE Customers.CustomerID = @customer_id AND StockItems.StockItemID = @stockitem_id GO
  • 12. Query Language Extensions: MATCH SELECT CustomerName, StockItemName FROM StockItems, Customers, Bought WHERE MATCH(Customers-(Bought)->StockItems) AND StockItemName = 'White chocolate snow balls 250g'
  • 14. Product Recommendations (“Before”) WITH Current_Usr AS ( SELECT CustomerID = 88, StockItemID = 226, -- 'White chocolate snow balls 250g' PurchasedCount = 1 ) , -- Identify the other users who have also purchased the item he/she is looking for Other_Usr AS ( SELECT C.CustomerID, P.StockItemID, Purchased_by_others = COUNT(*) FROM Sales.OrderLines AS OD JOIN Sales.Orders AS OH ON OH.OrderID=OD.OrderID JOIN Sales.Customers AS C ON OH.CustomerID=C.CustomerID JOIN Current_Usr AS P ON P.StockItemID=OD.StockItemID WHERE C.CustomerID<>P.CustomerID GROUP BY C.CustomerID, P.StockItemID ) , -- Find the other items which those other customers have also purchased Other_Items AS ( SELECT C.CustomerID, P.StockItemID, Other_purchased = COUNT(*) FROM Sales.OrderLines AS OD JOIN Sales.Orders AS OH ON OH.OrderID=OD.OrderID JOIN Other_Usr AS C ON OH.CustomerID=C.CustomerID JOIN Warehouse.StockItems AS P ON P.StockItemID=OD.StockItemID WHERE P.StockItemName<>'White chocolate snow balls 250g' GROUP BY C.CustomerID, P.StockItemID ) -- Outer query -- Recommend to the current user to the top items from those other items, -- ordered by the number of times they were purchased SELECT top 10 P.StockItemName, COUNT(Other_purchased) FROM Other_Items JOIN Warehouse.StockItems AS P ON P.StockItemID=Other_Items.StockItemID GROUP BY P.StockItemName ORDER BY COUNT(Other_purchased) DESC; GO
  • 15. SELECT TOP 10 RecommendedItem.StockItemName, COUNT(*) FROM StockItems AS Item, Customers AS C, Bought AS BoughtOther, Bought AS BoughtThis, StockItems AS RecommendedItem WHERE MATCH(RecommendedItem<-(BoughtOther)-C-(BoughtThis)->Item) AND Item.StockItemName LIKE 'White chocolate snow balls 250g’ AND (Item.StockItemName <> RecommendedItem.StockItemName) AND C.customerID <> 88 GROUP BY RecommendedItem.StockItemName ORDER BY COUNT(*) DESC; GO Product Recommendations with SQL Graph (“After”)
  • 16. SELECT TOP 10 RecommendedItem.StockItemName, COUNT(*) FROM StockItems AS Item, Customers AS C, Bought AS BoughtOther, Bought AS BoughtThis, StockItems AS RecommendedItem WHERE Item.StockItemName LIKE 'White chocolate snow balls 250g' AND MATCH(RecommendedItem<-(BoughtOther)-C-(BoughtThis)->Item) AND (Item.StockItemName <> RecommendedItem.StockItemName) and C.customerID <> 88 GROUP BY RecommendedItem.StockItemName ORDER BY COUNT(*) DESC; GO Product Recommendations with SQL Graph (“After”)
  • 17. Design Choices • Relational vs. Graph  Graph and relational designs can answer similar questions  But if traversal of relationships define the primary application requirements, Graph can solve this more intuitively and with less code  Recommendation Systems  Fraud Detection  Content Management  Bill of Materials, product hierarchy  CRM
  • 18.
  • 19. Adaptive Query Processing Interleaved Execution for MSTVFs Batch Mode Memory Grant Feedback Batch Mode Adaptive Joins ?...
  • 20. Query •The query text is parsed in a logical tree Transformations •QO comes up with equivalent variations of the tree Cardinality Estimation (CE) •CE estimates number of rows flowing through each operator in each tree Costing •Based on the CE, each equivalent tree gets a cost. The cheapest one is the winner. Plan Cache •The plan is cached for re- use by queries with the same text Query •Same query is executed Plan Cache •The previously cached plan is retrieved Memory, DOP •Based on the CE in the final plan, memory grant is acquired Query Execution •The query starts executing according to the plan Query Execution (QE) What could go wrong? Query Optimization (QO)
  • 21. Missing statistics Stale statistics Inadequate statistics sample rate Bad parameter sniffing scenarios Out-of-model query constructs • E.g. Multi-Statement TVFs, table variables, XQuery Assumptions not aligned with data being queried • E.g. independence vs. correlation
  • 22. Slow query response time due to inefficient plans Excessive resource utilization (CPU, Memory, IO) Spills to disk Reduced throughput and concurrency T-SQL refactoring to work around off- model statements
  • 23. Problem: Multi-statement table valued functions (MSTVFs) are treated as a black box by QP and we use a fixed optimization guess Interleaved Execution will materialize and use row counts for MSTVFs Downstream operations will benefit from the corrected MSTVF cardinality estimate
  • 24. Problem: Queries may spill to disk or take too much memory based on poor cardinality estimates MGF will adjust memory grants based on execution feedback MGF will remove spills and improve concurrency for repeating queries
  • 25. Problem: If cardinality estimates are skewed, we may choose an inappropriate join algorithm Adaptive Join will defer the choice of hash join or nested loop until after the first join input has been scanned Adaptive Join uses nested loop for small inputs, hash joins for large inputs
  • 26. 1 50,000 Cost Rows Adaptive Join Threshold Hash Join Nested Loop Join
  • 27.
  • 28. Better performance with Automatic Plan Correction Automatically fix problems without tuning Better Performance with Automatic Tuning Continuous performance plan monitoring and analysis Detect problematic plans Automatically fix performance problems caused by SQL plan choice regressions Querytimes Plan 1 Plan 2 Plan 3 Plan 2 Revert to previously effective plan
  • 29. • dm_db_tuning_recommendations Detect • and system corrects Turn on Auto • to “last known good” Reverts back Can be helpful for parameter sniffing situations Automatic Tuning
  • 30. Intelligent QP Adaptive QP Interleaved Execution Memory Grant Feedback Batch Mode? Batch Mode Adaptive Joins ? ? ? ? Interested in testing new QP features? Email IntelligentQP@microsoft.com
  • 31.
  • 32. SQL Graph Overview SQL Graph Architechture About SQL Graph Bulk Insert Best Practices Recommendation System on Million Song Dataset Product Recommendations in WideWorldImporters using SQL Graph Recursive Queries and Shortest Path Shortest Path on Yelp Dataset

Editor's Notes

  1. 7
  2. 28