OpenText Analytics Database 旧Vertica

技術情報サイト

Analytics Database

システムテーブルのカラム一覧を出力する方法

公開日:
更新日:
基本操作
#システムテーブル

はじめに

システムテーブルは、Verticaのクラスタの状態や、テーブル、プロジェクション、ユーザ等の詳細な情報を確認することができます。
各システムテーブルにどのような情報が含まれているか確認をするために、よくカラムの一覧を出力することがありますが、この時にスキーマ名(v_catalogもしくは v_monitor)で指定をする必要があります。
スキーマ名の指定を忘れてしまうことが多いので、カラムの一覧を確認する時は、ご注意ください。

実行結果

以下に実行結果をご紹介します。

//ユーザー作成のテーブルを確認する場合
dbadmin=> \d t_1
                                   List of Fields by Tables
 Schema | Table | Column |    Type     | Size | Default | Not Null | Primary Key | Foreign Key
--------+-------+--------+-------------+------+---------+----------+-------------+-------------
 public | t_1   | col1   | int         |    8 |         | f        | f           |
 public | t_1   | col2   | varchar(10) |   10 |         | f        | f           |
(2 rows)

//システムテーブルの一覧を出力
dbadmin=> \dS
                                                                            List of tables
  Schema   |                 Name                  |  Kind  |                                          Description                                           | Comment
-----------+---------------------------------------+--------+------------------------------------------------------------------------------------------------+---------
 v_catalog | access_policy                         | system | Access Policy information                                                                      |
 v_catalog | all_tables                            | system | A complete listing of all tables and views                                                     |
:
 v_monitor | user_sessions                         | system | User session history                                                                           |
 v_monitor | wos_container_storage                 | system | Storage information on WOS allocator                                                           |
(192 rows)

//v_catalogスキーマを指定しない場合
dbadmin=> \d access_policy;
Did not find any relation.

//v_catalogスキーマを指定した場合
dbadmin=> \d v_catalog.access_policy;
                                               List of Fields by Tables
  Schema   |     Table     |      Column       |     Type      | Size | Default | Not Null | Primary Key | Foreign Key
-----------+---------------+-------------------+---------------+------+---------+----------+-------------+-------------
 v_catalog | access_policy | access_policy_oid | int           |    8 |         | f        | f           |
 v_catalog | access_policy | column_name       | varchar(128)  |  128 |         | f        | f           |
 v_catalog | access_policy | epoch             | int           |    8 |         | f        | f           |
 v_catalog | access_policy | expression        | varchar(8192) | 8192 |         | f        | f           |
 v_catalog | access_policy | is_policy_enabled | varchar(128)  |  128 |         | f        | f           |
 v_catalog | access_policy | policy_type       | varchar(128)  |  128 |         | f        | f           |
 v_catalog | access_policy | table_name        | varchar(128)  |  128 |         | f        | f           |
(7 rows)

参考情報

Vertica System Tables
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/SystemTables/VerticaSystemTables.htm

検証バージョンについて

この記事の内容はVertica 9.2で確認しています。