Advertisement
Guest User

VALUES(CONVERT(XML,'...'))

a guest
Aug 18th, 2015
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 26.60 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-16"?>
  2. <ShowPlanXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.2" Build="11.0.9231.13" xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan">
  3.   <BatchSequence>
  4.     <Batch>
  5.       <Statements>
  6.         <StmtSimple StatementCompId="2" StatementEstRows="100" StatementId="1" StatementOptmLevel="FULL" StatementSubTreeCost="21.9051" StatementText="SELECT a.value('(child::text())[1]','INT')&#xD;&#xA;FROM (VALUES (CONVERT(XML,&#xD;&#xA;  '&lt;b&gt;&lt;a&gt;'+REPLACE(@p_str,' ','&lt;/a&gt;&lt;a&gt;')+'&lt;/a&gt;&lt;/b&gt;'&#xD;&#xA;))) AS t(x)&#xD;&#xA;CROSS APPLY x.nodes('//a') AS x(a)" StatementType="SELECT" QueryHash="0x775477326EA58929" QueryPlanHash="0xAB818A78810CB184" RetrievedFromCache="true">
  7.           <StatementSetOptions ANSI_NULLS="true" ANSI_PADDING="true" ANSI_WARNINGS="true" ARITHABORT="true" CONCAT_NULL_YIELDS_NULL="true" NUMERIC_ROUNDABORT="false" QUOTED_IDENTIFIER="true" />
  8.           <QueryPlan DegreeOfParallelism="1" CachedPlanSize="40" CompileTime="65" CompileCPU="4" CompileMemory="712">
  9.             <MemoryGrantInfo SerialRequiredMemory="0" SerialDesiredMemory="0" />
  10.             <OptimizerHardwareDependentProperties EstimatedAvailableMemoryGrant="1244765" EstimatedPagesCached="855776" EstimatedAvailableDegreeOfParallelism="5" />
  11.             <RelOp AvgRowSize="11" EstimateCPU="1E-05" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="100" LogicalOp="Compute Scalar" NodeId="0" Parallel="false" PhysicalOp="Compute Scalar" EstimatedTotalSubtreeCost="21.9051">
  12.               <OutputList>
  13.                 <ColumnReference Column="Expr1011" />
  14.               </OutputList>
  15.               <ComputeScalar>
  16.                 <DefinedValues>
  17.                   <DefinedValue>
  18.                     <ColumnReference Column="Expr1011" />
  19.                     <ScalarOperator ScalarString="[Expr1010]">
  20.                       <Identifier>
  21.                         <ColumnReference Column="Expr1010" />
  22.                       </Identifier>
  23.                     </ScalarOperator>
  24.                   </DefinedValue>
  25.                 </DefinedValues>
  26.                 <RelOp AvgRowSize="11" EstimateCPU="0.000418" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="100" LogicalOp="Inner Join" NodeId="1" Parallel="false" PhysicalOp="Nested Loops" EstimatedTotalSubtreeCost="21.9051">
  27.                   <OutputList>
  28.                     <ColumnReference Column="Expr1010" />
  29.                   </OutputList>
  30.                   <RunTimeInformation>
  31.                     <RunTimeCountersPerThread Thread="0" ActualRows="18" ActualEndOfScans="1" ActualExecutions="1" />
  32.                   </RunTimeInformation>
  33.                   <NestedLoops Optimized="false">
  34.                     <OuterReferences>
  35.                       <ColumnReference Column="Expr1000" />
  36.                       <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  37.                     </OuterReferences>
  38.                     <RelOp AvgRowSize="4043" EstimateCPU="0.000418" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="100" LogicalOp="Inner Join" NodeId="2" Parallel="false" PhysicalOp="Nested Loops" EstimatedTotalSubtreeCost="1.00452">
  39.                       <OutputList>
  40.                         <ColumnReference Column="Expr1000" />
  41.                         <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  42.                       </OutputList>
  43.                       <RunTimeInformation>
  44.                         <RunTimeCountersPerThread Thread="0" ActualRows="18" ActualEndOfScans="1" ActualExecutions="1" />
  45.                       </RunTimeInformation>
  46.                       <NestedLoops Optimized="false">
  47.                         <OuterReferences>
  48.                           <ColumnReference Column="Expr1000" />
  49.                         </OuterReferences>
  50.                         <RelOp AvgRowSize="4035" EstimateCPU="1.157E-06" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="1" LogicalOp="Constant Scan" NodeId="3" Parallel="false" PhysicalOp="Constant Scan" EstimatedTotalSubtreeCost="1.157E-06">
  51.                           <OutputList>
  52.                             <ColumnReference Column="Expr1000" />
  53.                           </OutputList>
  54.                           <RunTimeInformation>
  55.                             <RunTimeCountersPerThread Thread="0" ActualRows="1" ActualEndOfScans="1" ActualExecutions="1" />
  56.                           </RunTimeInformation>
  57.                           <ConstantScan>
  58.                             <Values>
  59.                               <Row>
  60.                                 <ScalarOperator ScalarString="CONVERT(xml,'&lt;b&gt;&lt;a&gt;'+replace([@p_str],' ',CONVERT_IMPLICIT(varchar(max),'&lt;/a&gt;&lt;a&gt;',0))+'&lt;/a&gt;&lt;/b&gt;',0)">
  61.                                   <Convert DataType="xml" Style="0" Implicit="false">
  62.                                     <ScalarOperator>
  63.                                       <Arithmetic Operation="ADD">
  64.                                         <ScalarOperator>
  65.                                           <Arithmetic Operation="ADD">
  66.                                             <ScalarOperator>
  67.                                               <Const ConstValue="'&lt;b&gt;&lt;a&gt;'" />
  68.                                             </ScalarOperator>
  69.                                             <ScalarOperator>
  70.                                               <Intrinsic FunctionName="replace">
  71.                                                 <ScalarOperator>
  72.                                                   <Identifier>
  73.                                                     <ColumnReference Column="@p_str" />
  74.                                                   </Identifier>
  75.                                                 </ScalarOperator>
  76.                                                 <ScalarOperator>
  77.                                                   <Const ConstValue="' '" />
  78.                                                 </ScalarOperator>
  79.                                                 <ScalarOperator>
  80.                                                   <Convert DataType="varchar(max)" Length="2147483647" Style="0" Implicit="true">
  81.                                                     <ScalarOperator>
  82.                                                       <Const ConstValue="'&lt;/a&gt;&lt;a&gt;'" />
  83.                                                     </ScalarOperator>
  84.                                                   </Convert>
  85.                                                 </ScalarOperator>
  86.                                               </Intrinsic>
  87.                                             </ScalarOperator>
  88.                                           </Arithmetic>
  89.                                         </ScalarOperator>
  90.                                         <ScalarOperator>
  91.                                           <Const ConstValue="'&lt;/a&gt;&lt;/b&gt;'" />
  92.                                         </ScalarOperator>
  93.                                       </Arithmetic>
  94.                                     </ScalarOperator>
  95.                                   </Convert>
  96.                                 </ScalarOperator>
  97.                               </Row>
  98.                             </Values>
  99.                           </ConstantScan>
  100.                         </RelOp>
  101.                         <RelOp AvgRowSize="17" EstimateCPU="9.6E-05" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="100" LogicalOp="Filter" NodeId="5" Parallel="false" PhysicalOp="Filter" EstimatedTotalSubtreeCost="1.0041">
  102.                           <OutputList>
  103.                             <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  104.                           </OutputList>
  105.                           <RunTimeInformation>
  106.                             <RunTimeCountersPerThread Thread="0" ActualRebinds="1" ActualRewinds="0" ActualRows="18" ActualEndOfScans="1" ActualExecutions="1" />
  107.                           </RunTimeInformation>
  108.                           <Filter StartupExpression="true">
  109.                             <RelOp AvgRowSize="17" EstimateCPU="1.004" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="200" LogicalOp="Table-valued function" NodeId="6" Parallel="false" PhysicalOp="Table-valued function" EstimatedTotalSubtreeCost="1.004">
  110.                               <OutputList>
  111.                                 <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  112.                               </OutputList>
  113.                               <RunTimeInformation>
  114.                                 <RunTimeCountersPerThread Thread="0" ActualRebinds="1" ActualRewinds="0" ActualRows="18" ActualEndOfScans="1" ActualExecutions="1" />
  115.                               </RunTimeInformation>
  116.                               <TableValuedFunction>
  117.                                 <DefinedValues>
  118.                                   <DefinedValue>
  119.                                     <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  120.                                   </DefinedValue>
  121.                                 </DefinedValues>
  122.                                 <Object Table="[XML Reader with XPath filter]" />
  123.                                 <ParameterList>
  124.                                   <ScalarOperator ScalarString="[Expr1000]">
  125.                                     <Identifier>
  126.                                       <ColumnReference Column="Expr1000" />
  127.                                     </Identifier>
  128.                                   </ScalarOperator>
  129.                                   <ScalarOperator ScalarString="(0)">
  130.                                     <Const ConstValue="(0)" />
  131.                                   </ScalarOperator>
  132.                                   <ScalarOperator ScalarString="NULL">
  133.                                     <Const ConstValue="NULL" />
  134.                                   </ScalarOperator>
  135.                                   <ScalarOperator ScalarString="NULL">
  136.                                     <Const ConstValue="NULL" />
  137.                                   </ScalarOperator>
  138.                                 </ParameterList>
  139.                               </TableValuedFunction>
  140.                             </RelOp>
  141.                             <Predicate>
  142.                               <ScalarOperator ScalarString="[Expr1000] IS NOT NULL">
  143.                                 <Compare CompareOp="IS NOT">
  144.                                   <ScalarOperator>
  145.                                     <Identifier>
  146.                                       <ColumnReference Column="Expr1000" />
  147.                                     </Identifier>
  148.                                   </ScalarOperator>
  149.                                   <ScalarOperator>
  150.                                     <Const ConstValue="NULL" />
  151.                                   </ScalarOperator>
  152.                                 </Compare>
  153.                               </ScalarOperator>
  154.                             </Predicate>
  155.                           </Filter>
  156.                         </RelOp>
  157.                       </NestedLoops>
  158.                     </RelOp>
  159.                     <RelOp AvgRowSize="11" EstimateCPU="1.1E-06" EstimateIO="0" EstimateRebinds="99" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="1" LogicalOp="Aggregate" NodeId="12" Parallel="false" PhysicalOp="Stream Aggregate" EstimatedTotalSubtreeCost="20.9001">
  160.                       <OutputList>
  161.                         <ColumnReference Column="Expr1010" />
  162.                       </OutputList>
  163.                       <RunTimeInformation>
  164.                         <RunTimeCountersPerThread Thread="0" ActualRows="18" ActualEndOfScans="0" ActualExecutions="18" />
  165.                       </RunTimeInformation>
  166.                       <StreamAggregate>
  167.                         <DefinedValues>
  168.                           <DefinedValue>
  169.                             <ColumnReference Column="Expr1010" />
  170.                             <ScalarOperator ScalarString="MIN(CASE WHEN [Expr1000] IS NULL THEN NULL ELSE CASE WHEN datalength(XML Reader with XPath filter.[value])&gt;=(128) THEN CONVERT_IMPLICIT(int,XML Reader with XPath filter.[lvalue],0) ELSE CONVERT_IMPLICIT(int,XML Reader with XPath filter.[value],0) END END)">
  171.                               <Aggregate AggType="MIN" Distinct="false">
  172.                                 <ScalarOperator>
  173.                                   <IF>
  174.                                     <Condition>
  175.                                       <ScalarOperator>
  176.                                         <Compare CompareOp="IS">
  177.                                           <ScalarOperator>
  178.                                             <Identifier>
  179.                                               <ColumnReference Column="Expr1000" />
  180.                                             </Identifier>
  181.                                           </ScalarOperator>
  182.                                           <ScalarOperator>
  183.                                             <Const ConstValue="NULL" />
  184.                                           </ScalarOperator>
  185.                                         </Compare>
  186.                                       </ScalarOperator>
  187.                                     </Condition>
  188.                                     <Then>
  189.                                       <ScalarOperator>
  190.                                         <Const ConstValue="NULL" />
  191.                                       </ScalarOperator>
  192.                                     </Then>
  193.                                     <Else>
  194.                                       <ScalarOperator>
  195.                                         <IF>
  196.                                           <Condition>
  197.                                             <ScalarOperator>
  198.                                               <Compare CompareOp="GE">
  199.                                                 <ScalarOperator>
  200.                                                   <Intrinsic FunctionName="datalength">
  201.                                                     <ScalarOperator>
  202.                                                       <Identifier>
  203.                                                         <ColumnReference Table="[XML Reader with XPath filter]" Column="value" />
  204.                                                       </Identifier>
  205.                                                     </ScalarOperator>
  206.                                                   </Intrinsic>
  207.                                                 </ScalarOperator>
  208.                                                 <ScalarOperator>
  209.                                                   <Const ConstValue="(128)" />
  210.                                                 </ScalarOperator>
  211.                                               </Compare>
  212.                                             </ScalarOperator>
  213.                                           </Condition>
  214.                                           <Then>
  215.                                             <ScalarOperator>
  216.                                               <Convert DataType="int" Style="0" Implicit="true">
  217.                                                 <ScalarOperator>
  218.                                                   <Identifier>
  219.                                                     <ColumnReference Table="[XML Reader with XPath filter]" Column="lvalue" />
  220.                                                   </Identifier>
  221.                                                 </ScalarOperator>
  222.                                               </Convert>
  223.                                             </ScalarOperator>
  224.                                           </Then>
  225.                                           <Else>
  226.                                             <ScalarOperator>
  227.                                               <Convert DataType="int" Style="0" Implicit="true">
  228.                                                 <ScalarOperator>
  229.                                                   <Identifier>
  230.                                                     <ColumnReference Table="[XML Reader with XPath filter]" Column="value" />
  231.                                                   </Identifier>
  232.                                                 </ScalarOperator>
  233.                                               </Convert>
  234.                                             </ScalarOperator>
  235.                                           </Else>
  236.                                         </IF>
  237.                                       </ScalarOperator>
  238.                                     </Else>
  239.                                   </IF>
  240.                                 </ScalarOperator>
  241.                               </Aggregate>
  242.                             </ScalarOperator>
  243.                           </DefinedValue>
  244.                         </DefinedValues>
  245.                         <RelOp AvgRowSize="4057" EstimateCPU="1E-07" EstimateIO="0" EstimateRebinds="99" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="1" LogicalOp="Top" NodeId="13" Parallel="false" PhysicalOp="Top" EstimatedTotalSubtreeCost="20.9">
  246.                           <OutputList>
  247.                             <ColumnReference Table="[XML Reader with XPath filter]" Column="value" />
  248.                             <ColumnReference Table="[XML Reader with XPath filter]" Column="lvalue" />
  249.                           </OutputList>
  250.                           <RunTimeInformation>
  251.                             <RunTimeCountersPerThread Thread="0" ActualRows="18" ActualEndOfScans="18" ActualExecutions="18" />
  252.                           </RunTimeInformation>
  253.                           <Top RowCount="false" IsPercent="false" WithTies="false">
  254.                             <TopExpression>
  255.                               <ScalarOperator ScalarString="(1)">
  256.                                 <Const ConstValue="(1)" />
  257.                               </ScalarOperator>
  258.                             </TopExpression>
  259.                             <RelOp AvgRowSize="4517" EstimateCPU="4.78647E-07" EstimateIO="0" EstimateRebinds="99" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="1" LogicalOp="Compute Scalar" NodeId="14" Parallel="false" PhysicalOp="Compute Scalar" EstimatedTotalSubtreeCost="20.9">
  260.                               <OutputList>
  261.                                 <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  262.                                 <ColumnReference Table="[XML Reader with XPath filter]" Column="value" />
  263.                                 <ColumnReference Table="[XML Reader with XPath filter]" Column="lvalue" />
  264.                                 <ColumnReference Column="Expr1009" />
  265.                               </OutputList>
  266.                               <ComputeScalar>
  267.                                 <DefinedValues>
  268.                                   <DefinedValue>
  269.                                     <ColumnReference Column="Expr1009" />
  270.                                     <ScalarOperator ScalarString="0x58">
  271.                                       <Const ConstValue="0x58" />
  272.                                     </ScalarOperator>
  273.                                   </DefinedValue>
  274.                                 </DefinedValues>
  275.                                 <RelOp AvgRowSize="4065" EstimateCPU="1.224E-05" EstimateIO="0" EstimateRebinds="99" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="1" LogicalOp="Filter" NodeId="15" Parallel="false" PhysicalOp="Filter" EstimatedTotalSubtreeCost="20.9">
  276.                                   <OutputList>
  277.                                     <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  278.                                     <ColumnReference Table="[XML Reader with XPath filter]" Column="value" />
  279.                                     <ColumnReference Table="[XML Reader with XPath filter]" Column="lvalue" />
  280.                                   </OutputList>
  281.                                   <RunTimeInformation>
  282.                                     <RunTimeCountersPerThread Thread="0" ActualRows="18" ActualEndOfScans="0" ActualExecutions="18" />
  283.                                   </RunTimeInformation>
  284.                                   <Filter StartupExpression="false">
  285.                                     <RelOp AvgRowSize="4065" EstimateCPU="1.00036" EstimateIO="0" EstimateRebinds="99" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="3.7606" LogicalOp="Table-valued function" NodeId="16" Parallel="false" PhysicalOp="Table-valued function" EstimatedTotalSubtreeCost="20.8998">
  286.                                       <OutputList>
  287.                                         <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  288.                                         <ColumnReference Table="[XML Reader with XPath filter]" Column="value" />
  289.                                         <ColumnReference Table="[XML Reader with XPath filter]" Column="lvalue" />
  290.                                       </OutputList>
  291.                                       <RunTimeInformation>
  292.                                         <RunTimeCountersPerThread Thread="0" ActualRebinds="18" ActualRewinds="0" ActualRows="18" ActualEndOfScans="0" ActualExecutions="18" />
  293.                                       </RunTimeInformation>
  294.                                       <TableValuedFunction>
  295.                                         <DefinedValues>
  296.                                           <DefinedValue>
  297.                                             <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  298.                                           </DefinedValue>
  299.                                           <DefinedValue>
  300.                                             <ColumnReference Table="[XML Reader with XPath filter]" Column="value" />
  301.                                           </DefinedValue>
  302.                                           <DefinedValue>
  303.                                             <ColumnReference Table="[XML Reader with XPath filter]" Column="lvalue" />
  304.                                           </DefinedValue>
  305.                                         </DefinedValues>
  306.                                         <Object Table="[XML Reader with XPath filter]" />
  307.                                         <ParameterList>
  308.                                           <ScalarOperator ScalarString="[Expr1000]">
  309.                                             <Identifier>
  310.                                               <ColumnReference Column="Expr1000" />
  311.                                             </Identifier>
  312.                                           </ScalarOperator>
  313.                                           <ScalarOperator ScalarString="(7)">
  314.                                             <Const ConstValue="(7)" />
  315.                                           </ScalarOperator>
  316.                                           <ScalarOperator ScalarString="XML Reader with XPath filter.[id]">
  317.                                             <Identifier>
  318.                                               <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  319.                                             </Identifier>
  320.                                           </ScalarOperator>
  321.                                           <ScalarOperator ScalarString="getdescendantlimit(XML Reader with XPath filter.[id])">
  322.                                             <Intrinsic FunctionName="getdescendantlimit">
  323.                                               <ScalarOperator>
  324.                                                 <Identifier>
  325.                                                   <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  326.                                                 </Identifier>
  327.                                               </ScalarOperator>
  328.                                             </Intrinsic>
  329.                                           </ScalarOperator>
  330.                                         </ParameterList>
  331.                                       </TableValuedFunction>
  332.                                     </RelOp>
  333.                                     <Predicate>
  334.                                       <ScalarOperator ScalarString="XML Reader with XPath filter.[id]=getancestor(XML Reader with XPath filter.[id],(1))">
  335.                                         <Compare CompareOp="EQ">
  336.                                           <ScalarOperator>
  337.                                             <Identifier>
  338.                                               <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  339.                                             </Identifier>
  340.                                           </ScalarOperator>
  341.                                           <ScalarOperator>
  342.                                             <Intrinsic FunctionName="getancestor">
  343.                                               <ScalarOperator>
  344.                                                 <Identifier>
  345.                                                   <ColumnReference Table="[XML Reader with XPath filter]" Column="id" />
  346.                                                 </Identifier>
  347.                                               </ScalarOperator>
  348.                                               <ScalarOperator>
  349.                                                 <Const ConstValue="(1)" />
  350.                                               </ScalarOperator>
  351.                                             </Intrinsic>
  352.                                           </ScalarOperator>
  353.                                         </Compare>
  354.                                       </ScalarOperator>
  355.                                     </Predicate>
  356.                                   </Filter>
  357.                                 </RelOp>
  358.                               </ComputeScalar>
  359.                             </RelOp>
  360.                           </Top>
  361.                         </RelOp>
  362.                       </StreamAggregate>
  363.                     </RelOp>
  364.                   </NestedLoops>
  365.                 </RelOp>
  366.               </ComputeScalar>
  367.             </RelOp>
  368.             <ParameterList>
  369.               <ColumnReference Column="@p_str" ParameterRuntimeValue="'78 91 01 12 34 56 78 91 01 12 34 56 78 91 01 12 34 56'" />
  370.             </ParameterList>
  371.           </QueryPlan>
  372.         </StmtSimple>
  373.       </Statements>
  374.     </Batch>
  375.   </BatchSequence>
  376. </ShowPlanXML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement