> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# StarRocks catalog

> Query another cluster with a StarRocks catalog using remote scans or shared-data direct reads.

A StarRocks catalog is an external catalog for querying native tables in another cluster without importing their data. It can also join remote tables with local tables. Unlike `default_catalog`, which represents the current cluster's internal data, a StarRocks catalog connects to a remote cluster using a configured account.

This guide calls the cluster running your SQL the **querying cluster** and the cluster owning the tables the **data cluster**. Both clusters must run builds that support the StarRocks catalog protocol and the selected scan transport. An FE HTTP endpoint alone does not make an older cluster compatible.

## Prerequisites

* On the querying cluster, the user creating the catalog needs the system-level `CREATE EXTERNAL CATALOG` privilege. Users querying it need the applicable catalog and table privileges. See [Query external data](/documents/4.2/data_source/catalog/query_external_data.md).
* On the data cluster, the account configured in the catalog needs `SELECT` on the tables to query. Requests use this configured account, not the querying user's remote identity. Local permissions and remote permissions are separate checks; grant local access accordingly.
* Querying FEs must reach the data cluster's FE HTTP endpoints. Use the HTTP port, not the MySQL or FE RPC port.
* For remote scans, querying BEs or CNs must reach the data cluster's BE or CN addresses and the transport ports returned by that cluster. Making only the FE reachable is insufficient.
* For direct reads, querying workers must reach the storage endpoints. The data cluster must also reach the credential service required by its storage provider.

## Choose a scan transport

| `starrocks.scan.transport` | How data is read | Requirements |
| - | - | - |
| `brpc_chunk` (default) | The data cluster scans its tables and streams native chunks over brpc. | Reachable brpc ports on the data cluster's BEs or CNs. |
| `arrow_flight` | The data cluster scans its tables and streams results over Arrow Flight. | Arrow Flight enabled on the data cluster's BEs or CNs, with reachable Arrow Flight ports. |
| `direct_lake` | Querying workers read the data cluster's shared-data storage directly after obtaining metadata and access information from its FE. | Shared-data tables on supported storage volumes, meeting the provider-specific access requirements below, with `cloud_native_fast_schema_evolution_v2` disabled. See [Direct reads](#direct-reads). |

Remote scans support native tables and materialized views in the data cluster, including shared-nothing and shared-data tables. Remote views and tables belonging to another external catalog are not exposed as queryable tables through this catalog. `direct_lake` only supports shared-data tables and materialized views.

## Create a catalog

Replace the endpoint hosts, ports, account, and password with your deployment's values. The account in this example must already exist on the data cluster.

```sql theme={null}
CREATE EXTERNAL CATALOG sr_catalog
PROPERTIES (
    "type" = "starrocks",
    "starrocks.fe.http.url" = "http://remote-fe-1:8030,http://remote-fe-2:8030",
    "starrocks.user" = "catalog_reader",
    "starrocks.password" = "<password>",
    "starrocks.scan.transport" = "brpc_chunk"
);
```

To use Arrow Flight, set `starrocks.scan.transport` to `arrow_flight`.

### Connection and scan properties

| Property | Required | Default | Description |
| - | - | - | - |
| `type` | Yes | None | Must be `starrocks`. |
| `starrocks.fe.http.url` | Yes | None | Comma-separated FE endpoints. Each accepts `http://host:port`, `https://host:port`, or `host:port` (HTTP). For HTTPS, use an endpoint configured to terminate TLS. |
| `starrocks.user` | Yes | None | Data-cluster account; cannot be empty. |
| `starrocks.password` | No | Empty string | Password for the data-cluster account. |
| `starrocks.scan.transport` | No | `brpc_chunk` | `brpc_chunk`, `arrow_flight`, or `direct_lake`. |
| `starrocks.fe.http.timeout.ms` | No | `10000` | FE HTTP connection and socket timeout, in milliseconds. This is not the SQL execution timeout. |
| `starrocks.fe.http.retry.times` | No | `3` | Additional HTTP retries when one endpoint is configured. With multiple endpoints, a request tries each endpoint once on transport failure, without repeating the list. |
| `catalog.access.control` | No | FE `access_control` value | Querying-cluster authorization mode. To use a configured StarRocks Ranger service, set `ranger`; see [Ranger integration](/documents/4.2/administration/user_privs/authorization/ranger_plugin.md). This does not replace data-cluster authorization. |

Unknown properties are rejected. Do not use JDBC properties such as `jdbc_uri`, a Thrift endpoint property, or `ranger.plugin.hive.service.name` for this catalog.

### Cache properties

| Property | Default | Description |
| - | - | - |
| `starrocks.cache.enable` | `true` | Enables metadata and statistics caches for this catalog. With `false`, accesses fetch from the remote FE; a query still pins its statistics snapshot. |
| `starrocks.cache.ttl.sec` | `3600` | Cache entry expiry after write, in seconds. |
| `starrocks.cache.refresh.sec` | `300` | Statistics snapshot refresh interval, in seconds. Access after the interval triggers asynchronous refresh; this is not a periodic refresh of all metadata. |
| `starrocks.cache.table.max.num` | `10000` | Maximum entries in each per-table cache (table metadata and statistics snapshots). |
| `starrocks.cache.partition.max.num` | `100000` | Maximum table-partition entries in the partition statistics cache. |
| `starrocks.cache.refresh.thread.num` | `4` | Thread pool size for background statistics refresh. |

Use positive values for cache intervals, capacities, and thread count. Non-positive values fall back to the defaults above. Database names, table names, and table schemas use TTL caches; the statistics refresh interval does not refresh these lists or schemas. Remote DDL and permission changes can therefore take time to appear in cached metadata. Remote scan preparation still checks the configured account's permissions.

## Query data

The following examples assume `sales.orders` exists on the data cluster and `crm.customers` exists in the querying cluster. Replace the database, table, and column names as needed.

```sql theme={null}
SHOW DATABASES FROM sr_catalog;
SHOW TABLES FROM sr_catalog.sales;
SELECT * FROM sr_catalog.sales.orders LIMIT 10;

SET CATALOG sr_catalog;
USE sales;
SELECT * FROM orders LIMIT 10;

SELECT o.order_id, c.customer_name
FROM sr_catalog.sales.orders AS o
JOIN default_catalog.crm.customers AS c
    ON o.customer_id = c.customer_id
LIMIT 10;
```

The catalog exposes user databases; remote `_statistics_`, `information_schema`, and `sys` databases are excluded. It is a read interface: do not use it to create, insert into, update, or delete remote tables. To copy results into the querying cluster, use an existing local destination table with `INSERT INTO ... SELECT ...`.

## Direct reads

**Note**

Currently, `direct_lake` does not support tables with `cloud_native_fast_schema_evolution_v2=true`. New shared-data tables enable this property by default, so even a table on S3 storage can be rejected. Use `brpc_chunk` or `arrow_flight` to query these tables instead.

Use a separate catalog when you want to choose direct reads explicitly:

```sql theme={null}
CREATE EXTERNAL CATALOG sr_lake
PROPERTIES (
    "type" = "starrocks",
    "starrocks.fe.http.url" = "http://remote-fe-1:8030",
    "starrocks.user" = "catalog_reader",
    "starrocks.password" = "<password>",
    "starrocks.scan.transport" = "direct_lake"
);
```

Storage access comes from the remote table's storage volume. Do not add object-store keys to the catalog properties. Object-storage direct reads require the data cluster to issue temporary read-only credentials scoped to the table's storage directories; issuance failure rejects the scan.

* **Supported object storage:** S3-type volumes (AWS S3 and S3-compatible stores), Azure ADLS2, and Google Cloud Storage. The volume's identity must be able to issue scoped credentials. For S3-type volumes, provider selection normally follows the endpoint; `aws.s3.direct_read.vendor` handles endpoints whose provider cannot be inferred. Valid values are `aws`, `aliyun`, `tencent`, `huawei`, and `s3_compatible`.
* **Huawei OBS:** Disabled by default. Before setting `aws.s3.direct_read.huawei.enabled=true` on the source volume, use a dedicated identity with only the required OBS and applicable KMS permissions. This setting records an administrator assertion; it does not inspect IAM permissions.
* **HDFS:** Disabled by default; requires `hdfs.direct_read.allow_unscoped=true` on the source volume. No scoped, read-only credential is issued. Effective HDFS permissions may allow other paths and writes or deletes. Enable only for a trusted querying cluster after reviewing permissions and NameNode/DataNode connectivity.
* **Unsupported direct-read storage:** Azure Blob volumes without a hierarchical namespace. Use `brpc_chunk` or `arrow_flight` for these volumes or when direct-read access requirements cannot be met.

See [Storage volume properties](/documents/4.2/sql-reference/sql-statements/cluster-management/storage_volume/CREATE_STORAGE_VOLUME.md) for the volume settings.

### Query timeout and credential lifetime

For object storage, the data cluster requests credentials for `max(starrocks_catalog_direct_read_sts_max_duration_second, 900)` seconds, rather than for each query's own timeout. The default requested lifetime is 3600 seconds. Credentials are cached and reused only while their remaining lifetime exceeds the statement's timeout budget plus a 30-second safety margin. The budget includes the execution timeout (`query_timeout` for SELECT, `insert_timeout` for INSERT ... SELECT or CTAS) and applicable query-queue waiting time.

The credential reuse window can be shorter than requested because of the storage provider or role-session limits. A query that cannot be covered is rejected during preparation. Lower its timeout or configure a suitable credential lifetime and issuing identity on the data cluster. See the [credential lifetime setting](/documents/4.2/administration/configuration/FE_parameters/shared_lake_other.md#starrocks_catalog_direct_read_sts_max_duration_second).

GCS rejects tokens with an unknown expiration or a lifetime exceeding the requested ceiling by default. The source-volume option `gcp.gcs.direct_read.allow_extended_lifetime=true` explicitly accepts a longer provider lifetime. The ceiling still limits cache reuse and query admission, but does not shorten the actual token lifetime. Revoking SQL access does not revoke tokens already delivered. See [Storage volume properties](/documents/4.2/sql-reference/sql-statements/cluster-management/storage_volume/CREATE_STORAGE_VOLUME.md) for details.

The timeout budget must also not exceed the data cluster's `lake_autovacuum_grace_period_minutes` (converted to seconds), because direct-read versions are not pinned against vacuum. A query exceeding this bound is rejected before scanning.

### Row-access and column-masking policies

Direct reads cannot enforce the data cluster's row-access or column-masking policies. By default, querying an affected table through `direct_lake` fails. To allow a remote scan that enforces these policies on the data cluster:

```sql theme={null}
SET enable_direct_lake_fallback_on_policy = true;
```

Ensure the remote-scan network prerequisites are also met. This switch applies to policy-related fallback; it is not a general fallback for storage or credential failures. Ordinary `EXPLAIN` skips the remote policy probe and still shows a direct-read plan, even when execution would fall back. To observe an actual fallback, use `EXPLAIN ANALYZE` (which executes the query), or inspect the profile or execution plan of an executed query. See [System variables](/documents/4.2/sql-reference/System_variable.md) for this switch.

## Manage the catalog and refresh metadata

```sql theme={null}
SHOW CATALOGS;
SHOW CREATE CATALOG sr_catalog;
REFRESH EXTERNAL TABLE sr_catalog.sales.orders;
```

`REFRESH EXTERNAL TABLE` can be run with the `REFRESH` privilege on the external table. The `ALTER` privilege is also accepted for compatibility. It invalidates the cached table metadata, its database's table-name list, and the table's statistics, then reloads the table metadata. Statistics are loaded again on demand. It does not refresh the database-name list, so it cannot make a newly created remote database visible immediately. With caching disabled, it has no cache to refresh. See [REFRESH EXTERNAL TABLE](/documents/4.2/sql-reference/sql-statements/table_bucket_part_index/REFRESH_EXTERNAL_TABLE.md).

To remove the local catalog definition without deleting remote data:

```sql theme={null}
SET CATALOG default_catalog;
DROP CATALOG sr_catalog;
```

## Troubleshooting

| Symptom | What to check |
| - | - |
| Required or unsupported property error | Use the exact property names above. Specify both FE HTTP endpoints and a non-empty user. |
| HTTP connection failure or missing API | Verify FE HTTP connectivity, endpoint configuration, and support for the catalog protocol on both clusters. |
| Access denied | Check local catalog/table privileges and the configured account's remote `SELECT` privilege separately. |
| Catalog is created, but a scan cannot connect | Check the BE/CN addresses advertised by the data cluster and the brpc or Arrow Flight port for the selected transport. |
| `direct read does not yet support cloud_native_fast_schema_evolution_v2` | The table has fast schema evolution v2 enabled, which is not supported by direct reads. Use `brpc_chunk` or `arrow_flight`. |
| Direct read rejects a table or storage volume | Verify shared-data table type, a supported volume, provider-specific access requirements, and the permitted query timeout. |
| Direct read rejects a policy-protected table | Use a remote-scan catalog or explicitly enable policy fallback. |
| Metadata is stale | Refresh an existing table or wait for the relevant cache TTL. For diagnosis, create a catalog with `starrocks.cache.enable = false`. |
| Query fails after remote schema changes | Refresh table metadata and retry. Avoid assuming cached metadata immediately tracks remote DDL. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.