Skip to content

Possible Error in MB to TB Conversion in Synapse Cost Calculation: SynapseServerlessWorkbook #37

Description

Hello team,

I have a question regarding the calculation in this line. Should it not be division by 1,000,000 to convert MB to Terabyte?

Below is the query copied from the KQL Query Mode. The issue would be these two lines:

| extend Approx_Accumulated_Cost=((TotalMBProcessed) * 5.0 / 100000.0) / 100 
| extend Approx_Cost_Per_Execution=((TotalMBProcessed) * 5.0 / 100000.0) / 100 / QueryCount

Full Query :

//Queries by completion type
SynapseBuiltinSqlPoolRequestsEnded
| where _ResourceId in~ ('/subscriptions/******')
| project 
    BytesProcessed=Properties.dataProcessedBytes,
    tostring(Identity),
    QueryHash=tostring(Properties.queryHash),
    QueryText=tostring(Properties.queryText),
    _ResourceId
| extend MbProcessed = case (
                           BytesProcessed < 10000000,
                           10000000,
                           BytesProcessed
                       ) / 1000 / 1000
| summarize 
    MaxSingleQueryMBProcessed=max(toint(MbProcessed)),
    TotalMBProcessed=sum(toint(MbProcessed)),
    QueryCount=count(),
    QueryHash=any(QueryHash),
    Resource=any(_ResourceId)
    by QueryText //using queryText because queryHash doesn’t change if only literals are different
| extend Approx_Accumulated_Cost=((TotalMBProcessed) * 5.0 / 100000.0) / 100 
| extend Approx_Cost_Per_Execution=((TotalMBProcessed) * 5.0 / 100000.0) / 100 / QueryCount
| order by TotalMBProcessed

Let me know if it was a mistake. I can contribute the fix if you like.

Thanks,

Ariane

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions