HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

What is 'Log Memory' in Query Store 2017

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whatlogquerystorememory2017

Problem

In SQL 2017 there is a new execution metric, 'Log memory' other than that it was added in 2017 I am not finding anything about it.

Execution metric: (SQL 2017)


CPU time, Duration, Execution Count, Logical Reads, Logical writes, Memory consumption, Physical Reads, CLR time, Degree of Parallelism (DOP), Row count, Log memory, TempDB memory, and Wait times

I believe I understand what all the other metrics are and why I might care.

I ran all the metrics for the top 5 resource consuming queries, during several specific periods. I recorded and now I am examining the results. I know the (very large) values for 'Log memory' are in KB's.

What exactly is the metric 'Log memory'?

Edit, having received two answers I checked

The answer by LowlyDBA suggests it is a combination of 5 related fields from sys.query_store_runtime_stats

Using the code to validate provided by jadarnel27 in their answer

I created the database '231682' and ran the test query for the 5 fields, I got results very similar

I summed (used =SUM() in Excel) my values and got 1,383,040 (bytes)

I looked at Query Store, for Log memory used (KB), it shows a value of 354,058,240 (KB), this number is orders of magnitude larger, it is also KB as compared to bytes, in bytes it would be 354,058,240,000 (bytes)

I summed the totals of all the fields and only got 1,655,236 (byte)

SELECT *
FROM sys.query_store_runtime_stats qsrs
WHERE qsrs.avg_log_bytes_used > 0;


I suspect the answer to my question, is that the 'Log memory' metric in SQL 2017, is not any real value. The value presented in this small experiment would be 354GB, unrealistically high.

Solution

If we look at the documentation for the underlying object, sys.query_store_runtime_stats, we'll see it has the following descriptions:

  • avg_log_bytes_used - Average number of bytes in the database log used by the query plan, within the aggregation interval.


Note: Azure SQL Data Warehouse will always return zero (0).

  • last_log_bytes_used - Number of bytes in the database log used by the last execution of the query plan, within the aggregation interval.


Note: Azure SQL Data Warehouse will always return zero (0).

  • min_log_bytes_used - Minimum number of bytes in the database log used by the query plan, within the aggregation interval.


Note: Azure SQL Data Warehouse will always return zero (0).

  • max_log_bytes_used - Maximum number of bytes in the database log used by the query plan, within the aggregation interval.


Note: Azure SQL Data Warehouse will always return zero (0).

  • stdev_log_bytes_used - Standard deviation of the number of bytes in the database log used by a query plan, within the aggregation interval.


Note: Azure SQL Data Warehouse will always return zero (0).

Context

StackExchange Database Administrators Q#231682, answer score: 10

Revisions (0)

No revisions yet.