240 likes | 401 Views
XPC Automatic Plan Choice Validation Using Performance Statistics. Ashit Gosalia, Xin Zhang. Graphical Query Plan. DW Query 150+ Nodes. Outline. Motivation Scalability – an example issue Overall Design Rules Domain independent Domain specific - Known Issues for DW Future work
E N D
XPCAutomatic Plan Choice Validation Using Performance Statistics DBTest2008 Workshop, Vancouver, BC Ashit Gosalia, Xin Zhang
Graphical Query Plan • DW Query • 150+ Nodes
Outline • Motivation • Scalability – an example issue • Overall Design • Rules • Domain independent • Domain specific - Known Issues for DW • Future work • Questions DBTest2008 Workshop, Vancouver, BC
Motivation • A rule-based tool for Microsoft SQL Server that helps users and developers achieve a better understanding of plan performance • Easy analysis of plans • Automation and integration with test infrastructure • Create a common vocabulary to describe plan problems • Training tool DBTest2008 Workshop, Vancouver, BC
Scalability Issue • Symptom • Only 1-2 threads are used on 8-way machine.
Scalability Issue Store Date Sales
Scalability Issue Store Date Sales
Scalability Issue - Impact Estimation • Based on Estimated Rows Per Thread • Scalability Issue Impact:* • 1 – (Total # of Rows/DOP) / (Total # of Max Rows Per Thread) *: It is a best case estimation, not accurate runtime estimation
Scalability Issue Store Date Sales 87%
Scalability Issue - Workload Results • Real world DW • 600GB of data • 100+ queries • 85% queries had scalability issues 10% of queries could perform at 8x DBTest2008 Workshop, Vancouver, BC 60% of queries could perform at 2x
Overall Design Input Plan Analysis Engine Output Result Logs TEXT Logs TEXT Rule1 Logs TEXT Rule2 Rule1 Tables Tables Tables XML Internal Tables Tables XML DBTest2008 Workshop, Vancouver, BC Tables XML
Domain Independent Rules • Inclusive \ Exclusive rows • Similar to code profilers • Help locate changes fast • Reprocessing ratio • Good plans drop rows fast • Skew measures • Help detect a known issue • Calculate impact • Join Order plan • Provide a different view of the plan DBTest2008 Workshop, Vancouver, BC
Known Issues for DW Showplan XML Statistics XML • Missing Statistics • Missing Indexes • Large Join Analysis* • Dynamic Partition Elimination (SQL Server 2005 and 2008) • Multi-Consumer Spool • Common Sub-Expression Detection* • Serial Execution Showplan XML+ • Scalability Issue • Gatekeeper Row • Cardinality Estimation Error DBTest2008 Workshop, Vancouver, BC
Future Work • Make this tool available to users • Extend and add rules • Add more data to SHOWPLAN • Create post analysis triage tools • Describe plan transformations concisely DBTest2008 Workshop, Vancouver, BC
Questions? • Contact information • Xin Zhang - Shin.Zhang@microsoft.com • Ashit Gosalia – AshitG@microsoft.com DBTest2008 Workshop, Vancouver, BC
Backup Slides DBTest2008 Workshop, Vancouver, BC
New Rule: Implementation • Pattern matching by XQuery • Implemented in T-SQL stored procedures • Impact Analysis based on Estimation and Actual DBTest2008 Workshop, Vancouver, BC
New Rule: Narrow Plans DBTest2008 Workshop, Vancouver, BC
New Rule: Narrow Plans DBTest2008 Workshop, Vancouver, BC
New Rule: Wide Plans DBTest2008 Workshop, Vancouver, BC
New Rule: Wide Plans DBTest2008 Workshop, Vancouver, BC
New Rule: Implementation DBTest2008 Workshop, Vancouver, BC
Architecture: Overall Sp_FromDir Sp_FromFile Sp_SetupFileIssuesFound Sp_FromTrace Sp_<Issue> Sp_UpdateFilesIssuesFound Sp_StoreDetails Sp_StoreIssue DBTest2008 Workshop, Vancouver, BC Sp_GetErrorInfo Sp_GetErrorInfo
Architecture: SP_<Issue> Sp_SetupIssuesFound Sp_KnownIssues ShowPlan XML Statistics XML Sp_MissingStats Sp_GateKeeperRows Sp_MissingIndexes Sp_Scalability Sp_BigJoin Sp_EstimatedRows DBTest2008 Workshop, Vancouver, BC Sp_DynamicPartitionElimination Sp_SerialExecution Sp_PTPDynamicPartitionElimination Sp_CSEDetection Sp_MultiConsumerSpool