phoenix 查看表主键和字段信息的命令

phoenix | 2019-09-13 10:02:39

1.phoenix查看表主键信息的命令

0: jdbc:phoenix:> !primarykeys SYSTEM.CATALOG

输出结果

+------------+--------------+-------------+----------------+----------+----------+--------------+------------+------------+--------------+----------+----------------+
| TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |  COLUMN_NAME   | KEY_SEQ  | PK_NAME  | ASC_OR_DESC  | DATA_TYPE  | TYPE_NAME  | COLUMN_SIZE  | TYPE_ID  | VIEW_CONSTANT  |
+------------+--------------+-------------+----------------+----------+----------+--------------+------------+------------+--------------+----------+----------------+
|            | SYSTEM       | CATALOG     | COLUMN_FAMILY  | 5        | PK       | A            | 12         | VARCHAR    | null         | 12       |                |
|            | SYSTEM       | CATALOG     | COLUMN_NAME    | 4        | PK       | A            | 12         | VARCHAR    | null         | 12       |                |
|            | SYSTEM       | CATALOG     | TABLE_NAME     | 3        | PK       | A            | 12         | VARCHAR    | null         | 12       |                |
|            | SYSTEM       | CATALOG     | TABLE_SCHEM    | 2        | PK       | A            | 12         | VARCHAR    | null         | 12       |                |
|            | SYSTEM       | CATALOG     | TENANT_ID      | 1        | PK       | A            | 12         | VARCHAR    | null         | 12       |                |
+------------+--------------+-------------+----------------+----------+----------+--------------+------------+------------+--------------+----------+----------------+

2.phoenix查看表字段信息的命令

0: jdbc:phoenix:> !desc SYSTEM.CATALOG

输出结果

+------------+--------------+-------------+--------------------------------+------------+-------------------+--------------+----------------+-----------------+-----------------+-----------+----------+--------+
| TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |          COLUMN_NAME           | DATA_TYPE  |     TYPE_NAME     | COLUMN_SIZE  | BUFFER_LENGTH  | DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN |
+------------+--------------+-------------+--------------------------------+------------+-------------------+--------------+----------------+-----------------+-----------------+-----------+----------+--------+
|            | SYSTEM       | CATALOG     | TENANT_ID                      | 12         | VARCHAR           | null         | null           | null            | null            | 1         |          |        |
|            | SYSTEM       | CATALOG     | TABLE_SCHEM                    | 12         | VARCHAR           | null         | null           | null            | null            | 1         |          |        |
|            | SYSTEM       | CATALOG     | TABLE_NAME                     | 12         | VARCHAR           | null         | null           | null            | null            | 0         |          |        |
|            | SYSTEM       | CATALOG     | COLUMN_NAME                    | 12         | VARCHAR           | null         | null           | null            | null            | 1         |          |        |
|            | SYSTEM       | CATALOG     | COLUMN_FAMILY                  | 12         | VARCHAR           | null         | null           | null            | null            | 1         |          |        |
|            | SYSTEM       | CATALOG     | TABLE_SEQ_NUM                  | -5         | BIGINT            | null         | null           | null            | null            | 1         |          |        |


3.phoenix查看所有表信息

0: jdbc:phoenix:> !tables

输出结果

+------------+--------------+--------------------------------------------------+---------------+----------+------------+----------------------------+-----------------+--------------+-----------------+--------+
| TABLE_CAT  | TABLE_SCHEM  |                    TABLE_NAME                    |  TABLE_TYPE   | REMARKS  | TYPE_NAME  | SELF_REFERENCING_COL_NAME  | REF_GENERATION  | INDEX_STATE  | IMMUTABLE_ROWS  | SALT_B |
+------------+--------------+--------------------------------------------------+---------------+----------+------------+----------------------------+-----------------+--------------+-----------------+--------+
|            | SYSTEM       | CATALOG                                          | SYSTEM TABLE  |          |            |                            |                 |              | false           | null   |
|            | SYSTEM       | FUNCTION                                         | SYSTEM TABLE  |          |            |                            |                 |              | false           | null   |
|            | SYSTEM       | LOG                                              | SYSTEM TABLE  |          |            |                            |                 |              | true            | 32     |
|            | SYSTEM       | SEQUENCE                                         | SYSTEM TABLE  |          |            |                            |                 |              | false           | null   |
|            | SYSTEM       | STATS                                            | SYSTEM TABLE  |          |            |                            |                 |              | false           | null   |
登录后即可回复 登录 | 注册
    
关注编程学问公众号