# System Tables

System tables are read-only relations in the `deltastream.sys` virtual schema that expose metadata about your DeltaStream organization. They can be queried using standard SQL `SELECT` statements, which makes them useful for programmatic access, automation, and agents that need to inspect or reason about the state of your DeltaStream resources.

## Syntax

```sql
SELECT column [, ...]
FROM deltastream.sys."<table_name>"
[ WHERE condition ]
[ ORDER BY column ]
[ LIMIT n ];
```

## Description

System tables provide the same information as the corresponding `LIST` and `DESCRIBE` commands, but as queryable SQL relations. This allows you to filter, sort, join, and aggregate metadata in ways that the dedicated commands do not support.

{% hint style="info" %}
**Note** System table names must be quoted with double quotes, e.g. `deltastream.sys."compute_pools"`.
{% endhint %}

### Access Control

Each system table enforces [role-based access control](/overview/core-concepts/access-control.md) automatically. Rows are filtered to only those resources the current role has `USAGE` privileges on. No additional `WHERE` clause is needed to scope results to the current role.

### Column Types

Columns in system tables use the following DeltaStream types:

| PostgreSQL type           | DeltaStream type |
| ------------------------- | ---------------- |
| `boolean`                 | `BOOLEAN`        |
| `smallint`                | `SMALLINT`       |
| `integer`                 | `INTEGER`        |
| `bigint`                  | `BIGINT`         |
| `varchar`, `text`, `uuid` | `VARCHAR`        |
| `timestamptz`             | `TIMESTAMP_LTZ`  |

## Available System Tables

| Table                                                                                         | Description                                                     |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [`audit_logs`](/reference/sql-syntax/systables/audit-logs.md)                                 | Audit log of all actions performed in the organization          |
| [`compute_pools`](/reference/sql-syntax/systables/compute-pools.md)                           | Compute pools defined in the organization                       |
| [`databases`](/reference/sql-syntax/systables/databases.md)                                   | Databases in the organization                                   |
| [`descriptor_sources`](/reference/sql-syntax/systables/descriptor-sources.md)                 | Protobuf descriptor sources                                     |
| [`function_sources`](/reference/sql-syntax/systables/function-sources.md)                     | Function source packages (JARs)                                 |
| [`functions`](/reference/sql-syntax/systables/functions.md)                                   | User-defined functions (UDFs)                                   |
| [`organization_defaults`](/reference/sql-syntax/systables/organization-defaults.md)           | Per-user session defaults (role, database, store, compute pool) |
| [`organization_subscriptions`](/reference/sql-syntax/systables/organization-subscriptions.md) | Subscription plan details for the organization                  |
| [`organizations`](/reference/sql-syntax/systables/organizations.md)                           | Organizations the current user is a member of                   |
| [`pgusers`](/reference/sql-syntax/systables/pgusers.md)                                       | PostgreSQL-compatible user credentials                          |
| [`queries`](/reference/sql-syntax/systables/queries.md)                                       | Streaming queries (active and historical)                       |
| [`query_tags`](/reference/sql-syntax/systables/query-tags.md)                                 | Key/value tags attached to queries                              |
| [`relation_columns`](/reference/sql-syntax/systables/relation-columns.md)                     | Column definitions for all relations                            |
| [`relations`](/reference/sql-syntax/systables/relations.md)                                   | Streams, changelogs, tables, materialized views, and indexes    |
| [`role_privileges`](/reference/sql-syntax/systables/role-privileges.md)                       | Privilege grants for roles                                      |
| [`roles`](/reference/sql-syntax/systables/roles.md)                                           | Roles defined in the organization                               |
| [`schema_registries`](/reference/sql-syntax/systables/schema-registries.md)                   | Schema registry connections                                     |
| [`schemas`](/reference/sql-syntax/systables/schemas.md)                                       | Schemas (namespaces) within databases                           |
| [`secrets`](/reference/sql-syntax/systables/secrets.md)                                       | Secrets (metadata only, values never exposed)                   |
| [`stores`](/reference/sql-syntax/systables/stores.md)                                         | External system connections                                     |
| [`user_grants`](/reference/sql-syntax/systables/user-grants.md)                               | User-to-role membership grants                                  |
| [`userdatas`](/reference/sql-syntax/systables/userdatas.md)                                   | Per-user key/value metadata (internal UI state)                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/systables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
