diff --git a/Lite/Controls/ServerTab.xaml b/Lite/Controls/ServerTab.xaml
index 2013c4bd..fb98b4ec 100644
--- a/Lite/Controls/ServerTab.xaml
+++ b/Lite/Controls/ServerTab.xaml
@@ -463,6 +463,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -546,6 +573,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -628,10 +682,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Lite/Controls/ServerTab.xaml.cs b/Lite/Controls/ServerTab.xaml.cs
index d166c928..cab6c616 100644
--- a/Lite/Controls/ServerTab.xaml.cs
+++ b/Lite/Controls/ServerTab.xaml.cs
@@ -661,20 +661,28 @@ private void UpdateMemorySummary(MemoryStatsRow? stats)
if (stats == null)
{
PhysicalMemoryText.Text = "--";
+ AvailablePhysicalMemoryText.Text = "--";
TotalServerMemoryText.Text = "--";
TargetServerMemoryText.Text = "--";
BufferPoolText.Text = "--";
PlanCacheText.Text = "--";
+ TotalPageFileText.Text = "--";
+ AvailablePageFileText.Text = "--";
MemoryStateText.Text = "--";
+ SqlMemoryModelText.Text = "--";
return;
}
PhysicalMemoryText.Text = FormatMb(stats.TotalPhysicalMemoryMb);
+ AvailablePhysicalMemoryText.Text = FormatMb(stats.AvailablePhysicalMemoryMb);
TotalServerMemoryText.Text = FormatMb(stats.TotalServerMemoryMb);
TargetServerMemoryText.Text = FormatMb(stats.TargetServerMemoryMb);
BufferPoolText.Text = FormatMb(stats.BufferPoolMb);
PlanCacheText.Text = FormatMb(stats.PlanCacheMb);
+ TotalPageFileText.Text = FormatMb(stats.TotalPageFileMb);
+ AvailablePageFileText.Text = FormatMb(stats.AvailablePageFileMb);
MemoryStateText.Text = stats.SystemMemoryState;
+ SqlMemoryModelText.Text = stats.SqlMemoryModel;
}
private static string FormatMb(double mb)
diff --git a/Lite/Services/LocalDataService.QueryStats.cs b/Lite/Services/LocalDataService.QueryStats.cs
index 4e7c9f44..f9a70d21 100644
--- a/Lite/Services/LocalDataService.QueryStats.cs
+++ b/Lite/Services/LocalDataService.QueryStats.cs
@@ -387,6 +387,15 @@ public async Task> GetTopProceduresByCpuAsync(int server
MIN(min_elapsed_time) AS min_elapsed_time,
MAX(max_elapsed_time) AS max_elapsed_time,
SUM(total_spills) AS total_spills,
+ MIN(min_logical_reads) AS min_logical_reads,
+ MAX(max_logical_reads) AS max_logical_reads,
+ MIN(min_physical_reads) AS min_physical_reads,
+ MAX(max_physical_reads) AS max_physical_reads,
+ MIN(min_logical_writes) AS min_logical_writes,
+ MAX(max_logical_writes) AS max_logical_writes,
+ MIN(min_spills) AS min_spills,
+ MAX(max_spills) AS max_spills,
+ MAX(cached_time) AS cached_time,
MAX(sql_handle) AS sql_handle,
MAX(plan_handle) AS plan_handle
FROM v_procedure_stats
@@ -426,8 +435,17 @@ ORDER BY SUM(delta_elapsed_time) DESC
MinElapsedTimeUs = reader.IsDBNull(12) ? 0 : reader.GetInt64(12),
MaxElapsedTimeUs = reader.IsDBNull(13) ? 0 : reader.GetInt64(13),
TotalSpills = reader.IsDBNull(14) ? 0 : reader.GetInt64(14),
- SqlHandle = reader.IsDBNull(15) ? "" : reader.GetString(15),
- PlanHandle = reader.IsDBNull(16) ? "" : reader.GetString(16)
+ MinLogicalReads = reader.IsDBNull(15) ? 0 : reader.GetInt64(15),
+ MaxLogicalReads = reader.IsDBNull(16) ? 0 : reader.GetInt64(16),
+ MinPhysicalReads = reader.IsDBNull(17) ? 0 : reader.GetInt64(17),
+ MaxPhysicalReads = reader.IsDBNull(18) ? 0 : reader.GetInt64(18),
+ MinLogicalWrites = reader.IsDBNull(19) ? 0 : reader.GetInt64(19),
+ MaxLogicalWrites = reader.IsDBNull(20) ? 0 : reader.GetInt64(20),
+ MinSpills = reader.IsDBNull(21) ? 0 : reader.GetInt64(21),
+ MaxSpills = reader.IsDBNull(22) ? 0 : reader.GetInt64(22),
+ CachedTime = reader.IsDBNull(23) ? (DateTime?)null : reader.GetDateTime(23),
+ SqlHandle = reader.IsDBNull(24) ? "" : reader.GetString(24),
+ PlanHandle = reader.IsDBNull(25) ? "" : reader.GetString(25)
});
}
@@ -637,6 +655,15 @@ public class ProcedureStatsRow
public long MinElapsedTimeUs { get; set; }
public long MaxElapsedTimeUs { get; set; }
public long TotalSpills { get; set; }
+ public long MinLogicalReads { get; set; }
+ public long MaxLogicalReads { get; set; }
+ public long MinPhysicalReads { get; set; }
+ public long MaxPhysicalReads { get; set; }
+ public long MinLogicalWrites { get; set; }
+ public long MaxLogicalWrites { get; set; }
+ public long MinSpills { get; set; }
+ public long MaxSpills { get; set; }
+ public DateTime? CachedTime { get; set; }
public string SqlHandle { get; set; } = "";
public string PlanHandle { get; set; } = "";
public string FullName => string.IsNullOrEmpty(SchemaName) ? ObjectName : $"{SchemaName}.{ObjectName}";
@@ -649,6 +676,7 @@ public class ProcedureStatsRow
public double MaxCpuMs => MaxWorkerTimeUs / 1000.0;
public double MinElapsedMs => MinElapsedTimeUs / 1000.0;
public double MaxElapsedMs => MaxElapsedTimeUs / 1000.0;
+ public string CachedTimeFormatted => CachedTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? "";
}
public class QueryStatsHistoryRow
diff --git a/Lite/Services/LocalDataService.QueryStore.cs b/Lite/Services/LocalDataService.QueryStore.cs
index 8723a932..368a64b3 100644
--- a/Lite/Services/LocalDataService.QueryStore.cs
+++ b/Lite/Services/LocalDataService.QueryStore.cs
@@ -49,7 +49,16 @@ public async Task> GetQueryStoreTopQueriesAsync(int serverId
MAX(query_plan_hash) AS query_plan_hash,
MAX(CASE WHEN is_forced_plan THEN TRUE ELSE FALSE END) AS is_forced_plan,
MAX(plan_forcing_type) AS plan_forcing_type,
- MAX(query_plan_text) AS query_plan_text
+ MAX(query_plan_text) AS query_plan_text,
+ MAX(execution_type_desc) AS execution_type_desc,
+ MIN(first_execution_time) AS first_execution_time,
+ AVG(CAST(avg_clr_time_us AS DOUBLE)) / 1000.0 AS avg_clr_time_ms,
+ AVG(CAST(avg_tempdb_space_used AS DOUBLE)) AS avg_tempdb_space_used,
+ AVG(CAST(avg_log_bytes_used AS DOUBLE)) AS avg_log_bytes_used,
+ MAX(plan_type) AS plan_type,
+ MAX(force_failure_count) AS force_failure_count,
+ MAX(last_force_failure_reason) AS last_force_failure_reason,
+ MAX(compatibility_level) AS compatibility_level
FROM v_query_store_stats
WHERE server_id = $1
AND collection_time >= $2
@@ -89,7 +98,16 @@ ORDER BY SUM(execution_count) * AVG(CAST(avg_duration_us AS DOUBLE)) DESC
QueryPlanHash = reader.IsDBNull(16) ? "" : reader.GetString(16),
IsForcedPlan = !reader.IsDBNull(17) && reader.GetBoolean(17),
PlanForcingType = reader.IsDBNull(18) ? "" : reader.GetString(18),
- QueryPlanText = reader.IsDBNull(19) ? null : reader.GetString(19)
+ QueryPlanText = reader.IsDBNull(19) ? null : reader.GetString(19),
+ ExecutionTypeDesc = reader.IsDBNull(20) ? "" : reader.GetString(20),
+ FirstExecutionTime = reader.IsDBNull(21) ? (DateTime?)null : reader.GetDateTime(21),
+ AvgClrTimeMs = reader.IsDBNull(22) ? 0 : ToDouble(reader.GetValue(22)),
+ AvgTempdbSpaceUsed = reader.IsDBNull(23) ? 0 : ToDouble(reader.GetValue(23)),
+ AvgLogBytesUsed = reader.IsDBNull(24) ? 0 : ToDouble(reader.GetValue(24)),
+ PlanType = reader.IsDBNull(25) ? "" : reader.GetString(25),
+ ForceFailureCount = reader.IsDBNull(26) ? 0 : Convert.ToInt64(reader.GetValue(26)),
+ LastForceFailureReason = reader.IsDBNull(27) ? "" : reader.GetString(27),
+ CompatibilityLevel = reader.IsDBNull(28) ? 0 : Convert.ToInt32(reader.GetValue(28))
});
}
@@ -291,7 +309,17 @@ public class QueryStoreRow
public bool IsForcedPlan { get; set; }
public string PlanForcingType { get; set; } = "";
public string? QueryPlanText { get; set; }
+ public string ExecutionTypeDesc { get; set; } = "";
+ public DateTime? FirstExecutionTime { get; set; }
+ public double AvgClrTimeMs { get; set; }
+ public double AvgTempdbSpaceUsed { get; set; }
+ public double AvgLogBytesUsed { get; set; }
+ public string PlanType { get; set; } = "";
+ public long ForceFailureCount { get; set; }
+ public string LastForceFailureReason { get; set; } = "";
+ public int CompatibilityLevel { get; set; }
public bool HasQueryPlan => !string.IsNullOrEmpty(QueryPlanText);
+ public string FirstExecutionTimeLocal => ServerTimeHelper.FormatServerTime(FirstExecutionTime);
public string LastExecutionTimeLocal => ServerTimeHelper.FormatServerTime(LastExecutionTime);
public double TotalCpuMs => TotalExecutions * AvgCpuTimeMs;
public double TotalDurationMs => TotalExecutions * AvgDurationMs;