---
title: "cache-rules list"
description: "List cache rules for a database"
canonical: "https://pgbeam.com/docs/cli/projects/cache-rules/list"
last-updated: "2026-10-30T13:45:52.000Z"
---

# cache-rules list

> List cache rules for a database

URL: https://pgbeam.com/docs/cli/projects/cache-rules/list

{/* Auto-generated from CLI commands. Do not edit. Run `pnpm generate:cli-docs` to regenerate. */}

List all tracked query shapes and their caching status for a database. Shows the query hash, a truncated SQL pattern, query type, whether caching is enabled, call count, average latency, and PgBeam's caching recommendation. Results are paginated. Use `--page-size` and `--page-token` to navigate pages.

## Usage

```bash
pgbeam cache-rules list [flags]
```

## Options

| Option                  | Description                                                                | Required | Default |
| ----------------------- | -------------------------------------------------------------------------- | -------- | ------- |
| `--database-id <value>` | ID of the database whose cache rules to list                               | Yes      | -       |
| `--page-size <value>`   | Number of entries per page (1-100). Defaults to the API default.           | No       | -       |
| `--page-token <value>`  | Pagination token returned from a previous list call to fetch the next page | No       | -       |

> **Global options**
>
> All [global options](/docs/cli/global-options) (`--token`, `--profile`,
> `--project`, `--org`, `--json`, `--no-color`, `--no-trunc`, `--debug`) are
> also available on this command.

## Examples

```bash
# List cache rules for a database
pgbeam cache-rules list --database-id db_xxx

# Get the first 20 rules
pgbeam cache-rules list --database-id db_xxx --page-size 20

# Get the next page using a pagination token
pgbeam cache-rules list --database-id db_xxx --page-token <token>

# List as JSON
pgbeam cache-rules list --database-id db_xxx --json
```

## Output

Displays a table with columns: Hash, Query, Type, Cached, Calls, Avg (ms), and Recommendation. If more pages are available, prints the `--page-token` value for the next page. With `--json`, returns the full paginated response.