Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(studio): cache hit rate on query perf with pg_stat_statements (#39804)

kemal.earthec53ba827b58
diff --git a/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceGrid.tsx b/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceGrid.tsx
index a35322a52de..5cad7d106c4 100644
--- a/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceGrid.tsx
+++ b/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceGrid.tsx
@@ -280,11 +280,14 @@ export const QueryPerformanceGrid = ({
}
if (col.id === 'cache_hit_rate') {
+ const numericValue = typeof value === 'number' ? value : parseFloat(value)
return (
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums font-mono">
- {typeof value === 'number' && !isNaN(value) && isFinite(value) ? (
- <p className={cn(value.toFixed(2) === '0.00' && 'text-foreground-lighter')}>
- {value.toLocaleString(undefined, {
+ {typeof numericValue === 'number' &&
+ !isNaN(numericValue) &&
+ isFinite(numericValue) ? (
+ <p className={cn(numericValue.toFixed(2) === '0.00' && 'text-foreground-lighter')}>
+ {numericValue.toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}