> For the complete documentation index, see [llms.txt](https://docs.percona.com/percona-monitoring-and-management/3/llms.txt).

# QAN Stored metrics: Filters panel

The Filters panel on the left hand side of the [QAN dashboard](https://docs.percona.com/percona-monitoring-and-management/3/use/qan/index.md) helps you narrow down query data in the **Stored metrics** tab. Use it to focus on specific metrics, database instances, or performance issues.

*Image: !image*

## Understanding filters

- The **Filter** panel lists the filters grouped by category. It also shows the percentage of the main metrics (explained below). If you select a different metric, the percentages on the left panel will change as per this metric. When you select a metric, it reduces the overview list as per the matching filter.
- When [label-based access control (LBAC)](https://docs.percona.com/percona-monitoring-and-management/3/admin/roles/access-control/intro.md) is enabled, filter options are automatically limited to match your role’s permissions. You will only see databases, services, and environments you have access to.
- The first five of each category are shown. If there are more, the list is expanded by clicking **Show all** beside the category name, and collapsed again with **Show top 5**.
- Applying a filter may make other filters inapplicable. These become grayed out and inactive.
- Click the chart symbol to navigate directly to an item’s associated dashboard.
- Separately, the global **Time range** setting filters results by time, either your choice of **Absolute time range**, or one of the predefined **Relative time ranges**.

*Image: !image*

## Available filter groups

The available filter groups depend on the database type you’re monitoring.

### Common filter groups

These filter groups are available for all database types. Most of them correspond to standard labels assigned when you add a service. For the full list of labels and how to set them, see [Labels reference](https://docs.percona.com/percona-monitoring-and-management/3/reference/labels-reference.md).

- **Command Type**: filters by SQL command class (SELECT, INSERT, UPDATE, etc.)
- **Fingerprint**: filters by normalized query pattern
- **Node Type**
- **Environment**
- **Availability Zone**
- **Cluster**
- **Replication Set**
- **Database**
- **Schema**
- **Node Name**
- **Service Name**
- **Client Host**
- **User Name**
- **Service Type**

### MySQL-specific filter groups

- **Command Type**: filters by SQL command class (SELECT, INSERT, UPDATE, etc.)
- **Fingerprint**: Filters by normalized query pattern

### MongoDB-specific filter groups

- **Plan Summary**: filters queries by execution plan type (COLLSCAN, IXSCAN, etc.) to easily identify inefficient full collection scans

### PostgreSQL-specific filter groups

- **Application**: filters queries by the application name that generated them
- **Command Type**

## Custom filter groups

Filter queries using custom `key='value'` pairs from query comments. Only genuine comments are parsed, not quoted string that contain comment-like characters. This feature is disabled by default.

### Supported technologies and agents

- MySQL (`perfschema`),
- PostgreSQL (`pg_stat_monitor`)

**Supported formats**

```sh
key='value'
key = 'value'
key ='value'
key= 'value'
```

**Example**

*Image: !image*

In the image above we have tagged queries running databases on Windows using the following comment:

```sh
comment: /* OperationSystem='windows' */.
```

Queries from the database running on Linux are tagged with:

```sh
/* OperationSystem='linux' */.
```

All types of comments and multicomments are supported `(/* */, --, # etc)`.

So the queries are as follows:

```sh
SELECT * /* OperationSystem='windows' */ FROM city;
SELECT city /* OperationSystem='linux' */ FROM world;
```

In the output, you can see another custom group in the `OperationSystem` filter. Use this to easily filter by any custom key or value.

### Enabling custom filter groups

- **via CLI**: While adding a service through CLI use the flag `comments-parsing`. Possible values are `on/off`.

  Example for adding MySQL with comments parsing on:

  ```sh
  pmm-admin add mysql --username=root --password=root-password --comments-parsing="on"
  ```

- **via UI**: While adding a service through the UI you will see new checkbox to `enable/disable` comments parsing for current service.

  *Image: !image*

MySQL CLI

- If you are using official MySQL CLI to trigger queries, start mysql with `--comments` flag. Otherwise comments will not be parsed.
- In case of PGSM (`pg_stat_monitor`), set the DB variable `pgsm_extract_comments=yes`
