Default catalog

更新时间:
复制 MD 格式

StarRocks 2.3 and later provide an Internal Catalog named default_catalog for managing internal data. Each StarRocks cluster has one and only one Internal Catalog. StarRocks currently does not support renaming or creating additional Internal Catalogs.

Query internal data

Prerequisites

Before you begin, ensure that you have:

Query data

  1. Connect to your StarRocks instance.

  2. (Optional) Select a database.

    List all databases:

    SHOW DATABASES;

    Or specify the catalog explicitly:

    SHOW DATABASES FROM default_catalog;

    Switch to a database. Both forms are equivalent — include the catalog name if you are not already in default_catalog:

    USE <db_name>;
    -- or
    USE <catalog_name>.<db_name>;

    Alternatively, switch the catalog and database in two steps:

    SET CATALOG <catalog_name>;
    USE <db_name>;
  3. Run a query:

    SELECT * FROM <table_name>;

    If you skipped step 2, include the database name in the query:

    SELECT * FROM <db_name>.<table_name>;

Examples

The following examples show three equivalent ways to query olap_db.olap_table.

Switch to the database first, then query:

USE olap_db;
SELECT * FROM olap_table limit 1;

Or specify the database directly in the query:

SELECT * FROM olap_db.olap_table limit 1;

Or use the full three-part path including the catalog:

SELECT * FROM default_catalog.olap_db.olap_table limit 1;