Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/PlanViewer.App/Controls/QueryStoreGridControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
Expand Down Expand Up @@ -190,9 +189,8 @@ private async System.Threading.Tasks.Task FetchPlansForRangeAsync()
_filteredRows.Clear();

// Start global + ribbon wait stats early (they don't depend on plan results)
System.Threading.Tasks.Task? globalWaitTask = null;
if (_waitStatsSupported && _waitStatsEnabled && _slicerStartUtc.HasValue && _slicerEndUtc.HasValue)
globalWaitTask = FetchGlobalWaitStatsOnlyAsync(_slicerStartUtc.Value, _slicerEndUtc.Value, ct);
_ = FetchGlobalWaitStatsOnlyAsync(_slicerStartUtc.Value, _slicerEndUtc.Value, ct);

try
{
Expand Down Expand Up @@ -417,7 +415,8 @@ private async System.Threading.Tasks.Task FetchGlobalWaitStatsOnlyAsync(
if (ct.IsCancellationRequested) { return; }
WaitStatsProfile.SetRibbonData(ribbonData);
}
catch (Exception ex) { Debug.WriteLine($"[WAITSTATS] FetchGlobalWaitStatsOnlyAsync EXCEPTION: {ex}"); }
catch (OperationCanceledException) { }
catch (Exception) { }
finally
{
WaitStatsProfile.SetLoading(false);
Expand Down Expand Up @@ -450,7 +449,8 @@ private async System.Threading.Tasks.Task FetchPerPlanWaitStatsAsync(
}
UpdateWaitBarMode();
}
catch (Exception ex) { Debug.WriteLine($"[WAITSTATS] FetchPerPlanWaitStatsAsync EXCEPTION: {ex}"); }
catch (OperationCanceledException) { }
catch (Exception) { }
}

/// <summary>
Expand Down
16 changes: 8 additions & 8 deletions src/PlanViewer.Core/Services/QueryStoreService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public static async Task<List<QueryStorePlan>> FetchTopPlansAsync(
// avg- variants still rank by total CPU (most impactful plan).
var orderClause = key switch
{
"cpu" => "total_cpu_us",
"duration" => "total_duration_us",
"reads" => "total_reads",
"writes" => "total_writes",
"physical-reads" => "total_physical_reads",
"memory" => "total_memory_pages",
"executions" => "total_executions",
_ => "total_cpu_us"
"cpu" => "ps.total_cpu_us",
"duration" => "ps.total_duration_us",
"reads" => "ps.total_reads",
"writes" => "ps.total_writes",
"physical-reads" => "ps.total_physical_reads",
"memory" => "ps.total_memory_pages",
"executions" => "ps.total_executions",
_ => "ps.total_cpu_us"
};

// Final ORDER BY — either a total or avg column from ranked CTE.
Expand Down
Loading