# Query performance

## What you can do here

The Query Performance dashboard gives you insight into how your database queries are performing. You can identify slow queries, get AI-powered optimization suggestions, and view or terminate queries that are currently running.

## Performance alerts

### Needs Attention (500ms)

A query needs attention once the average execution time exceeds 500ms. This indicates performance is degrading and should be investigated.

### Critical (1000ms)

A query is critical once the average execution time exceeds 1000ms. This has a significant impact on application performance and user experience. Immediate action is required.

{% hint style="warning" %}
Queries flagged as Needs Attention should be investigated, and those flagged as Critical require immediate attention.
{% endhint %}

## Minimum query duration

Each Servoy Cloud environment has a default minimum query duration threshold set to 20ms. Queries faster than this threshold are not shown in the dashboard.

To change the minimum duration:

1. Go to Admin Settings
2. Click on the [Environment](https://docs.servoy.com/reference/servoy-cloud/administration/settings#environment) tab
3. Change the value of "Min query duration"
4. Save changes

## ServoyAI Query Analyzer

The AI can analyze slow queries and suggest optimizations. To use the analyzer:

1. Navigate to the Query Performance dashboard from the Environment Details overview
2. Click the **Show more** button on the query you want to analyze
3. Click the ServoyAI icon
4. Read and accept the [Servoy Cloud Privacy policy](https://docs.servoy.com/reference/privacy-policy-servoyai#servoyai)
5. Request suggestions

When creating a support ticket from a query analysis, the SQL query is automatically included so you don't have to copy it manually.

## Running Queries

The Running Queries tab shows all database queries that are currently being executed in your environment. This lets you spot long-running or stuck queries and terminate them if needed — without needing access to the database directly.

**Where to find it:** Environments > \[Environment Name] > Query Performance > **Running Queries**

From this view you can:

* See all active queries with execution details, timing, and the user that triggered them
* Hover over a truncated query to see the full SQL
* Click the refresh icon to update the list
* Click the X icon next to a query to terminate it immediately

Only users with the right permissions can view and terminate queries.

<figure><img src="https://3933488479-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpWd52BKwABWxF2lScUK%2Fuploads%2FJp00P4Rjfuhwc51dfkro%2Fccc_running_queries.gif?alt=media&#x26;token=55888ae5-60aa-497a-b4f4-fc164cbe727a" alt="Servoy Cloud Control Center showing the Running Queries view with active database queries, timing, and terminate options"><figcaption></figcaption></figure>
