This topic describes what a default catalog is and how to use a default catalog to query internal data in a StarRocks cluster.
Default Catalog
StarRocks 2.3 and later allow you to use an internal catalog to manage internal data in a StarRocks cluster. Each StarRocks cluster has only one internal catalog named default_catalog. You cannot modify the name of the internal catalog of a StarRocks cluster or create another internal catalog for the StarRocks cluster.
Query internal data
Note Replace
<db_name> and
<table_name> in this topic with the actual values.
- Connect to the StarRocks cluster. For more information, see Getting started.
- If you use the MySQL client to connect to the StarRocks cluster, the
default_catalogcatalog is accessed by default after the connection is complete. - If you use a Java Database Connectivity (JDBC) connection string to connect to the StarRocks cluster, you can specify the database to be accessed in the
default_catalog.db_nameformat.
- If you use the MySQL client to connect to the StarRocks cluster, the
- Optional:View all databases in the StarRocks cluster.
SHOW DATABASES; -- Specify the name of the catalog. SHOW DATABASES FROM default_catalog; - Optional:Switch to the specified database.
USE <db_name>; -- Specify the name of the catalog. USE default_catalog.<db_name>; - Query internal data.
SELECT * FROM <table_name>;If you do not specify a database in the preceding steps, you can specify it in the query statement.- If you do not specify the name of the catalog, execute the following statement to query internal data:
SELECT * FROM <db_name>.<table_name>; - If you specify the name of the catalog, execute the following statement to query internal data:
SELECT * FROM default_catalog.<db_name>.<table_name>;
- If you do not specify the name of the catalog, execute the following statement to query internal data: