# Chalk CLI Reference: Queries
source: https://docs.chalk.ai/cli#queries

Inspect recent query executions, view query plans, and analyze query performance. Useful for debugging and optimizing feature pipelines.

## `chalk queries list`
source: https://docs.chalk.ai/cli?command=queries_list

```bash
chalk queries list
```

List recent query executions with optional filtering

**Flags**

- `--include-latency <include-latency>` (bool, default `true`)
  Include latency information in the output.
- `--min-latency-ms <min-latency-ms>` (string)
  Filter queries with latency greater than specified milliseconds.
- `--query-plan-id <query-plan-id>` (string)
  Filter by query plan ID.
- `--meta-query-id <meta-query-id>` (int, default `0`)
  Filter by meta query ID.
- `--meta-query-name <meta-query-name>` (string)
  Filter by meta query name.
- `--id <id>` (string)
  Filter by query ID (partial match).
- `--branch-filter <branch-filter>` (string)
  Filter by branch name.
- `--agent-id <agent-id>` (string)
  Filter by agent ID.
- `--root-pkey <root-pkey>` (string)
  Filter by root namespace primary key.
- `--duration <duration>` (string, default `1h`)
  Time window to search (e.g., 1h, 24h, 7d).
- `--limit <limit>` (int, default `100`)
  Maximum number of results to return.
- `--has-errors <has-errors>` (bool, default `false`)
  Filter to only show queries with errors.

## `chalk queries get`
source: https://docs.chalk.ai/cli?command=queries_get

```bash
chalk queries get [query-id]
```

Retrieve detailed information about a specific query run by its ID

**Arguments**

- `query-id` (string)
  The ID of the query run to retrieve

**Flags**

- `--approximate-timestamp <approximate-timestamp>` (string)
  Approximate timestamp for query lookup (RFC3339 format, e.g., 2024-01-15T10:30:00Z).

## `chalk meta-queries list`
source: https://docs.chalk.ai/cli?command=meta_queries_list

```bash
chalk meta-queries list
```

List meta queries with optional filtering

**Flags**

- `--name-filter <name-filter>` (string)
  Filter meta queries by name (partial match).
- `--start <start>` (string)
  Start time for filtering (RFC3339 format or duration like -24h).
- `--end <end>` (string)
  End time for filtering (RFC3339 format or duration like -1h).
- `--has-name <has-name>` (bool, default `false`)
  Filter to only show meta queries with names.
- `--limit <limit>` (int, default `100`)
  Maximum number of results to return.

## `chalk meta-queries get`
source: https://docs.chalk.ai/cli?command=meta_queries_get

```bash
chalk meta-queries get [meta-query-id]
```

Retrieve detailed information about a specific meta query by its ID

**Arguments**

- `meta-query-id` (string)
  The ID of the meta query to retrieve

## `chalk query-plan get`
source: https://docs.chalk.ai/cli?command=query_plan_get

```bash
chalk query-plan get [query-plan-id]
```

Retrieve detailed information about a specific query plan by its ID

**Arguments**

- `query-plan-id` (string)
  The ID of the query plan to retrieve

## `chalk plan-cache adhoc list`
source: https://docs.chalk.ai/cli?command=plan_cache_adhoc_list

```bash
chalk plan-cache adhoc list
```

List adhoc queries with pagination and filtering support

**Flags**

- `--limit <limit>` (int, default `20`)
  Maximum number of queries to return.
- `--cursor <cursor>` (string)
  Pagination token for fetching the next page.
- `--query-name <query-name>` (string)
  Filter by query name.
- `--environment-id <environment-id>` (string)
  Filter by environment ID (if not provided, uses context).
