Default catalog
This topic describes what the default catalog is, and how to query the internal data of StarRocks by using the default catalog.
StarRocks 2.3 and later provide an internal catalog to manage the internal data of StarRocks. Each StarRocks cluster has only one internal catalog named default_catalog
. Currently, you cannot modify the name of the internal catalog or create a new internal catalog.
Query internal data
-
Connect your StarRocks cluster.
- If you use the MySQL client to connect the StarRocks cluster, you go to
default_catalog
by default after connecting. - If you use JDBC to connect the StarRocks cluster, you can go directly to the destination database in the default catalog by specifying
default_catalog.db_name
when connecting.
- If you use the MySQL client to connect the StarRocks cluster, you go to
-
(Optional) Execute the following statement to view all databases in StarRocks. See SHOW DATABASES to view the output of this statement.
SHOW DATABASES;
Or
SHOW DATABASES FROM catalog_name;
-
(Optional) Execute the following statement to go to the destination database.
USE db_name;
Or
USE default_catalog.db_name;
-
Query internal data. For more usages of the SELECT statement, see SELECT.
SELECT * FROM table_name;
If you do not specify the database in the preceding steps, you can directly specify it in a select query.
SELECT * FROM db_name.table_name;
Or
SELECT * FROM default_catalog.db_name.table_name;
Examples
To query data in olap_db.olap_table
, you can perform one of the following operations:
USE olap_db;
SELECT * FROM olap_table limit 1;
Or
SELECT * FROM olap_db.olap_table limit 1;
Or
SELECT * FROM default_catalog.olap_db.olap_table limit 1;
References
To query data from external data sources, see Query external data.