import { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogSection, DialogSectionSeparator, DialogTitle, DialogTrigger, Tooltip, TooltipContent, TooltipTrigger, } from 'ui' import { Admonition } from 'ui-patterns' import { DocsButton } from './DocsButton' import { InlineLinkClassName } from './InlineLink' import { DOCS_URL } from '@/lib/constants' import { ResponseError } from '@/types' interface HighQueryCostErrorProps { error: ResponseError suggestions?: string[] onSelectLoadData?: () => void } export const HighCostError = ({ error, suggestions, onSelectLoadData, }: HighQueryCostErrorProps) => { return (
{!!onSelectLoadData && ( )}
) } const HighQueryCostDialog = ({ error, suggestions = [] }: HighQueryCostErrorProps) => { const metadata = error.metadata return ( event.preventDefault()}> Estimated query cost exceeds safety thresholds Preventive measure to mitigate impacting the database

The dashboard runs optimized SQL queries on your project’s database to load data for this interface.

However, the query was skipped as its{' '} estimated cost

Estimated cost: {metadata?.cost.toLocaleString()}

Determined via the EXPLAIN command

{' '} is high and could place significant load on the database with high disk I/O or CPU usage.

{suggestions.length > 0 && ( <>

Suggested steps

{suggestions.length > 0 && (

You may check the following to lower the cost of the query

    {suggestions.map((x) => (
  • {x}
  • ))}
)}
)}
) } const LoadDataWarningDialog = ({ error, onSelectLoadData, }: { error: ResponseError onSelectLoadData: () => void }) => { const metadata = error.metadata return ( event.preventDefault()}> Confirm to proceed loading data Preventive measure to mitigate impacting the database

The query to load your table's data was initially skipped as its{' '} estimated cost

Estimated cost: {metadata?.cost.toLocaleString()}

Determined via the EXPLAIN command

{' '} is high and could place significant load on the database with high disk I/O or CPU usage.

You may proceed to run the query, and we'll suppress this warning for this table for the rest of this browser session.

) }