Execution plan compute scala

sakuraime 2,341 Reputation points
2020-11-12T03:43:15.61+00:00

What actually compute scala in execution plan do ?
39232-computerscalaer.jpg

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. m 4,276 Reputation points
    2020-11-12T05:56:42.547+00:00

    Hi @sakuraime ,

    What actually compute scala in execution plan do ?

    Code as next, it will shows what the compute scalar do in your execution plan:

    SET SHOWPLAN_TEXT ON  
    GO  
    

    39261-20201112computescalaruse.jpg

    Test on my side, it is used as next:
    1.DEFINE:([AdventureWorks2017].[Sales].[SalesOrderHeader].[SalesOrderNumber]=isnull(N'SO'+CONVERT(nvarchar(23),[AdventureWorks2017].[Sales].[SalesOrderHeader].[SalesOrderID],0),N'* ERROR *'))
    2.DEFINE:([AdventureWorks2017].[Sales].[SalesOrderHeader].[TotalDue]=isnull([AdventureWorks2017].[Sales].[SalesOrderHeader].[SubTotal]+[AdventureWorks2017].[Sales].[SalesOrderHeader].[TaxAmt]+[AdventureWorks2017].[Sales].[SalesOrderHeader].[Freight],($0.0000)))

    You can check on your own side. And then quote from this doc.: sql-server-execution-plan-operators-part-3
    SQL Server Compute Scalar operator is used to calculate a new value from the existing row value by performing a scalar computation operation that results a computed value. These Scalar computations includes conversion or concatenation of the scalar value...

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.


1 additional answer

Sort by: Most helpful
  1. Shashank Singh 6,251 Reputation points
    2020-11-12T05:16:02.343+00:00

    What is "Scala" ? Is r not working in your keyboard ? You have the answer you are looking for in below link. Hover mouse over the scalar operator and you would see something like [[sod].LineTotal] = Scalar Operator([AdventureWorks2014].[Sales].[SalesOrderDetail].[LineTotal] as [sod].[LineTotal]). This is just example.

    why-does-this-execution-plan-have-compute-scalars

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.