本部分中的系统表位于 v_catalog
架构中。这些表提供数据库中的对象的相关信息(元数据);比如表、约束、用户、投影等。
V_CATALOG 架构
- 1: ACCESS_POLICY
- 2: ALL_TABLES
- 3: AUDIT_MANAGING_USERS_PRIVILEGES
- 4: CA_BUNDLES
- 5: CATALOG_SUBSCRIPTION_CHANGES
- 6: CATALOG_SYNC_STATE
- 7: CATALOG_TRUNCATION_STATUS
- 8: CERTIFICATES
- 9: CLIENT_AUTH
- 10: CLIENT_AUTH_PARAMS
- 11: CLUSTER_LAYOUT
- 12: COLUMNS
- 13: COMMENTS
- 14: COMPLEX_TYPES
- 15: CONSTRAINT_COLUMNS
- 16: CRYPTOGRAPHIC_KEYS
- 17: DATABASES
- 18: DIRECTED_QUERIES
- 19: DUAL
- 20: ELASTIC_CLUSTER
- 21: EPOCHS
- 22: FAULT_GROUPS
- 23: FOREIGN_KEYS
- 24: GRANTS
- 25: HCATALOG_COLUMNS
- 26: HCATALOG_SCHEMATA
- 27: HCATALOG_TABLES
- 28: HCATALOG_TABLE_LIST
- 29: INHERITING_OBJECTS
- 30: INHERITED_PRIVILEGES
- 31: KEYWORDS
- 32: LARGE_CLUSTER_CONFIGURATION_STATUS
- 33: LICENSE_AUDITS
- 34: LICENSES
- 35: LOAD_BALANCE_GROUPS
- 36: LOG_PARAMS
- 37: LOG_QUERIES
- 38: LOG_TABLES
- 39: MATERIALIZE_FLEXTABLE_COLUMNS_RESULTS
- 40: MODELS
- 41: NETWORK_ADDRESSES
- 42: NODES
- 43: NODE_SUBSCRIPTION_CHANGE_PHASES
- 44: NODE_SUBSCRIPTIONS
- 45: ODBC_COLUMNS
- 46: PASSWORD_AUDITOR
- 47: PASSWORDS
- 48: PRIMARY_KEYS
- 49: PROFILE_PARAMETERS
- 50: PROFILES
- 51: PROJECTION_CHECKPOINT_EPOCHS
- 52: PROJECTION_COLUMNS
- 53: PROJECTION_DELETE_CONCERNS
- 54: PROJECTIONS
- 55: RESOURCE_POOL_DEFAULTS
- 56: RESOURCE_POOLS
- 57: ROLES
- 58: ROUTING_RULES
- 59: SCHEMATA
- 60: SEQUENCES
- 61: SESSION_SUBSCRIPTIONS
- 62: SHARDS
- 63: STORAGE_LOCATIONS
- 64: SUBCLUSTERS
- 65: SUBCLUSTER_RESOURCE_POOL_OVERRIDES
- 66: SYSTEM_COLUMNS
- 67: SYSTEM_TABLES
- 68: TABLE_CONSTRAINTS
- 69: TABLES
- 70: TEXT_INDICES
- 71: TYPES
- 72: USER_AUDITS
- 73: USER_CLIENT_AUTH
- 74: USER_CONFIGURATION_PARAMETERS
- 75: USER_FUNCTION_PARAMETERS
- 76: USER_FUNCTIONS
- 77: USER_PROCEDURES
- 78: USER_TRANSFORMS
- 79: USERS
- 80: VIEW_COLUMNS
- 81: VIEW_TABLES
- 82: VIEWS
1 - ACCESS_POLICY
提供有关现有访问策略的信息。
特权
默认情况下,只有超级用户可以查看此表。超级用户可以使用以下语句授予非超级用户对此表的访问权限。非超级用户只能看到其所拥有的表中的行:
=> GRANT SELECT ON access_policy TO PUBLIC
示例
以下查询返回了表 public.customer_dimension
中的所有访问策略:
=> \x
=> SELECT policy_type, is_policy_enabled, table_name, column_name, expression FROM access_policy WHERE table_name = 'public.customer_dimension';
-[ RECORD 1 ]-----+----------------------------------------------------------------------------------------
policy_type | Column Policy
is_policy_enabled | Enabled
table_name | public.customer_dimension
column_name | customer_address
expression | CASE WHEN enabled_role('administrator') THEN customer_address ELSE '**************' END
2 - ALL_TABLES
提供有关 Vertica 数据库中表的摘要信息。
示例
onenode=> SELECT DISTINCT table_name, table_type FROM all_tables
WHERE table_name ILIKE 't%';
table_name | table_type
------------------------+--------------
types | SYSTEM TABLE
trades | TABLE
tuple_mover_operations | SYSTEM TABLE
tables | SYSTEM TABLE
tuning_recommendations | SYSTEM TABLE
testid | TABLE
table_constraints | SYSTEM TABLE
transactions | SYSTEM TABLE
(8 rows)
onenode=> SELECT table_name, table_type FROM all_tables
WHERE table_name ILIKE 'my%';
table_name | table_type
------------+------------
mystocks | VIEW
(1 row)
=> SELECT * FROM all_tables LIMIT 4;
-[ RECORD 1 ]-------------------------------------------
schema_name | v_catalog
table_id | 10206
table_name | all_tables
table_type | SYSTEM TABLE
remarks | A complete listing of all tables and views
-[ RECORD 2 ]-------------------------------------------
schema_name | v_catalog
table_id | 10000
table_name | columns
table_type | SYSTEM TABLE
remarks | Table column information
-[ RECORD 3 ]-------------------------------------------
schema_name | v_catalog
table_id | 10054
table_name | comments
table_type | SYSTEM TABLE
remarks | User comments on catalog objects
-[ RECORD 4 ]-------------------------------------------
schema_name | v_catalog
table_id | 10134
table_name | constraint_columns
table_type | SYSTEM TABLE
remarks | Table column constraint information
3 - AUDIT_MANAGING_USERS_PRIVILEGES
提供有关权限、创建、修改和删除用户以及身份验证更改的摘要信息。此表是 LOG_PARAMS、LOG_QUERIES 和 LOG_TABLES 的联接,已根据 Managing_Users_Privileges 类别进行了筛选。
4 - CA_BUNDLES
存储通过 创建 CA 捆绑包 创建的证书颁发机构 (CA) 捆绑包。
特权
-
请参阅 CA 捆绑包 OID、名称和所有者:CA 捆绑包的超级用户或所有者。
-
请参阅 CA 捆绑包内容:捆绑包的所有者
使用 CERTIFICATES 进行联接
CA_BUNDLES 仅存储 OID。由于对 CA 捆绑包的操作需要证书和所有者名称,因此可以使用以下查询将捆绑包映射到证书和所有者名称:
=> SELECT user_name AS owner_name,
owner AS owner_oid,
b.name AS bundle_name,
c.name AS cert_name
FROM (SELECT name,
STRING_TO_ARRAY(certificates) :: array[INT] AS certs
FROM ca_bundles) b
LEFT JOIN certificates c
ON CONTAINS(b.certs, c.oid)
LEFT JOIN users
ON user_id = owner
ORDER BY 1;
owner_name | owner_oid | bundle_name | cert_name
------------+-------------------+--------------+-----------
dbadmin | 45035996273704962 | ca_bundle | root_ca
dbadmin | 45035996273704962 | ca_bundle | ca_cert
(2 rows)
另请参阅
5 - CATALOG_SUBSCRIPTION_CHANGES
列出对编录订阅所做的更改。
6 - CATALOG_SYNC_STATE
显示 Eon 模式数据库节点何时将其编录同步到公共存储。
7 - CATALOG_TRUNCATION_STATUS
指示编录在公共存储上的最新程度。如果当前编录版本与编录截断版本相同,则是最新的。
编录截断版本 (CTV) 是 Vertica 群集在崩溃、关闭或休眠后进行恢复时使用的版本。一个群集中的所有节点只有一个 CTV。
9 - CLIENT_AUTH
提供有关客户端身份验证方法的信息。
值越高表示优先级越高。Vertica 使用优先级从高到低的身份验证方法尝试对用户进行身份验证。例如:
-
优先级 10 比优先级 5 高。
-
优先级 0 为最低的值。
示例
此示例显示如何获取您创建的每个客户端身份验证方法的相关信息:
=> SELECT * FROM client_auth;
auth_oid | auth_name | is_auth_enabled | auth_host_type | auth_host_address | auth_method | auth_parameters | auth_priority | method_priority | address_priority
-------------------+-------------+-----------------+----------------+-------------------+-------------+-----------------+---------------+-----------------+------------------
45035996274059694 | v_gss | True | HOST | 0.0.0.0/0 | GSS | | 0 | 5 | 96
45035996274059696 | v_trust | True | LOCAL | | TRUST | | 0 | 0 | 0
45035996274059698 | v_ldap | True | HOST | 10.19.133.123/ | LDAP | | 0 | 5 | 128
45035996274059700 | RejectNoSSL | True | HOSTNOSSL | 0.0.0.0/0 | REJECT | | 0 | 10 | 96
45035996274059702 | v_hash | True | LOCAL | | HASH | | 0 | 2 | 0
45035996274059704 | v_tls | True | HOSTSSL | 1.1.1.1/0 | TLS | | 0 | 5 | 96
(6 rows)
另请参阅
10 - CLIENT_AUTH_PARAMS
提供分配了参数值的客户端身份验证方法的相关信息。
示例
以下示例将展示如何检索创建的所有身份验证方法的参数名称和值。具有参数的身份验证方法如下:
-
v_ident
-
v_ldap
-
v_ldap1
=> SELECT * FROM CLIENT_AUTH_PARAMS;
auth_oid | auth_name | auth_parameter_name | auth_parameter_value
-------------------+---------------+---------------------+------------------------------
45035996273741304 | v_ident | system_users | root
45035996273741332 | v_gss | |
45035996273741350 | v_password | |
45035996273741368 | v_trust | |
45035996273741388 | v_ldap | host | ldap://172.16.65.177
45035996273741388 | v_ldap | binddn_prefix | cn=
45035996273741388 | v_ldap | binddn_suffix | ,dc=qa_domain,dc=com
45035996273741406 | RejectNoSSL | |
45035996273741424 | RejectWithSSL | |
45035996273741450 | v_md5 | |
45035996273904044 | l_tls | |
45035996273906566 | v_hash | |
45035996273910432 | v_ldap1 | host | ldap://172.16.65.177
45035996273910432 | v_ldap1 | basedn | dc=qa_domain,dc=com
45035996273910432 | v_ldap1 | binddn | cn=Manager,dc=qa_domain,dc=com
45035996273910432 | v_ldap1 | bind_password | secret
45035996273910432 | v_ldap1 | search_attribute | cn
(17 rows)
11 - CLUSTER_LAYOUT
显示参与群集的节点以及影响这些节点的容错组(在 Enterprise 模式数据库中)或子群集(在 Eon 模式数据库中)的实际排列的相对位置。暂时节点不会显示在群集布局环中,因为它们不保留任何常驻数据。
另请参阅
大型群集12 - COLUMNS
提供表列信息。
示例
从 COLUMNS
表中检索表和列信息:
=> SELECT table_schema, table_name, column_name, data_type, is_nullable
FROM columns WHERE table_schema = 'store'
AND data_type = 'Date';
table_schema | table_name | column_name | data_type | is_nullable
--------------+-------------------+------------------------+-----------+-------------
store | store_dimension | first_open_date | Date | f
store | store_dimension | last_remodel_date | Date | f
store | store_orders_fact | date_ordered | Date | f
store | store_orders_fact | date_shipped | Date | f
store | store_orders_fact | expected_delivery_date | Date | f
store | store_orders_fact | date_delivered | Date | f
6 rows)
DATETIME_PRECISION
为 NULL,因为表定义未声明精度:
=> CREATE TABLE c (c TIMESTAMP);
CREATE TABLE
=> SELECT table_name, column_name, datetime_precision FROM columns
WHERE table_name = 'c';
table_name | column_name | datetime_precision
------------+-------------+--------------------
c | c |
(1 row)
DATETIME_PRECISION
为 4,因为表定义将精度声明为 4:
=> DROP TABLE c;
=> CREATE TABLE c (c TIMESTAMP(4));
CREATE TABLE
=> SELECT table_name, column_name, datetime_precision FROM columns
WHERE table_name = 'c';
table_name | column_name | datetime_precision
------------+-------------+--------------------
c | c | 4
标识列是仅适用于数字列类型的序列。要标识表中的哪一列(如果有)是标识列,请搜索 COLUMNS
表,在表 testid 中查找标识列:
=> CREATE TABLE testid (c1 IDENTITY(1, 1, 1000), c2 INT);
=> \x
Expanded display is on.
=> SELECT * FROM COLUMNS WHERE is_identity='t' AND table_name='testid';
-[ RECORD 1 ]------------+--------------------
table_id | 45035996273719486
table_schema | public
table_name | testid
is_system_table | f
column_id | 45035996273719486-1
column_name | c1
data_type | int
data_type_id | 6
data_type_length | 8
character_maximum_length |
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 1
is_nullable | f
column_default |
is_identity | t
使用 SEQUENCES
表获得关于 testid 中序列的详细信息:
=> SELECT * FROM sequences WHERE identity_table_name='testid';
-[ RECORD 1 ]-------+--------------------
sequence_schema | public
sequence_name | testid_c1_seq
owner_name | dbadmin
identity_table_name | testid
session_cache_count | 1000
allow_cycle | f
output_ordered | f
increment_by | 1
minimum | 1
maximum | 9223372036854775807
current_value | 0
sequence_schema_id | 45035996273704976
sequence_id | 45035996273719488
owner_id | 45035996273704962
identity_table_id | 45035996273719486
有关序列和标识列的更多信息,请参阅 序列。
13 - COMMENTS
返回关于与数据库中的对象相关联的注释的信息。
当心
由于此表的大部分数据是通过查询其他 Vertica 编录表获取的,因此查询此表可能会很慢。14 - COMPLEX_TYPES
包含有关内联复杂类型 (复杂类型) 的信息。
每个外部表中的每个复杂类型在内部都具有唯一的类型,即使这些类型在结构上是相同的(比如两个不同的 ROW(int,int))。此内联类型在创建使用该类型的表时创建,并在删除表时自动删除。内联复杂类型不能在其他表中共享或重用。
COMPLEX_TYPES 表中的每一行代表一种复杂类型中的一个组件(字段)。一个 ROW 的每个字段生成一行,一个 ARRAY 生成一行,一个 MAP 生成两行。
原生 (ROS) 表中使用的基元类型数组不包含在 COMPLEX_TYPES 表中。其包含在 TYPES 表中。
示例
以下示例显示了定义单个外部表后的类型和字段值。
=> CREATE EXTERNAL TABLE warehouse(
name VARCHAR, id_map MAP<INT,VARCHAR>,
data row(record INT, total FLOAT, description VARCHAR(100)),
prices ARRAY[INT], comment VARCHAR(200), sales_total FLOAT, storeID INT)
AS COPY FROM ... PARQUET;
=> SELECT type_id,type_kind,type_name,field_id,field_name,field_type_name,field_position
FROM COMPLEX_TYPES ORDER BY type_id,field_name;
type_id | type_kind | type_name | field_id | field_name | field_type_name | field_position
-------------------+-----------+-----------------------+----------+-------------+-----------------+----------------
45035996274278280 | Map | _ct_45035996274278280 | 6 | key | int | 0
45035996274278280 | Map | _ct_45035996274278280 | 9 | value | varchar(80) | 1
45035996274278282 | Row | _ct_45035996274278282 | 9 | description | varchar(80) | 2
45035996274278282 | Row | _ct_45035996274278282 | 6 | record | int | 0
45035996274278282 | Row | _ct_45035996274278282 | 7 | total | float | 1
45035996274278284 | Array | _ct_45035996274278284 | 6 | | int | 0
(6 rows)
15 - CONSTRAINT_COLUMNS
记录有关表列约束的信息。
特权
非超级用户:不需要任何显式权限。您只会看到您有权查看的表的记录。
17 - DATABASES
提供有关该 Vertica 安装中的数据库的信息。
示例
此示例从主数据库中查询数据库表。
=> SELECT * FROM DATABASES;
-[ RECORD 1 ]----------+-------------------------------------------------------------
database_id | 45035996273704976
database_name | VMart
owner_id | 45035996273704962
owner_name | dbadmin
start_time | 2017-10-22 05:16:22.066961-04
compliance_message | The database is in compliance with respect to raw data size.
export_subnet | 0
load_balance_policy | none
backend_address_family | ipv4
branch_name |
18 - DIRECTED_QUERIES
返回关于定向查询的信息。
特权
超级用户截断的查询结果
字段 INPUT_QUERY 和 ANNOTATED_QUERY 的查询结果在 ~32K 个字符之后会被截断。可以使用两种方法获取这两个字段的完整内容:
-
使用语句 GET DIRECTED QUERY。
-
使用 EXPORT_CATALOG 导出定向查询。
19 - DUAL
DUAL 是一个单列的“虚拟”表,只有一条记录,记录的值为 X;例如:
=> SELECT * FROM DUAL;
dummy
-------
X
(1 row)
您可以编写以下类型的查询:
=> SELECT 1 FROM dual;
?column?
----------
1
(1 row)
=> SELECT current_timestamp, current_user FROM dual;
?column? | current_user
-------------------------------+--------------
2010-03-08 12:57:32.065841-05 | release
(1 row)
=> CREATE TABLE t1(col1 VARCHAR(20), col2 VARCHAR(2));
=> INSERT INTO T1(SELECT 'hello' AS col1, 1 AS col2 FROM dual);)
=> SELECT * FROM t1;
col1 | col2
-------+------
hello | 1
(1 row
限制
不能为 DUAL 创建 投影。
21 - EPOCHS
对于最近关闭的时期,列出关闭的日期和时间以及已关闭时期相应的时期数。EPOCHS 表可能会根据当前提交活动返回不同数量的行。
示例
=> SELECT * FROM EPOCHS;
epoch_close_time | epoch_number
-------------------------------+--------------
2018-11-12 16:05:15.552571-05 | 16
(1 row)
查询历史数据
如果需要有关时期和相应的日期信息的历史数据,请查询 DC_TRANSACTION_ENDS 表。
=> select dc.end_epoch,min(dc.time),max(dc.time) from dc_transaction_ends dc group by end_epoch;
end_epoch | min | max
-----------+-------------------------------+-------------------------------
214 | 2018-10-12 08:05:47.02075-04 | 2018-10-15 10:22:24.015292-04
215 | 2018-10-15 10:22:47.015172-04 | 2018-10-15 13:00:44.888984-04
...
226 | 2018-10-15 15:03:47.015235-04 | 2018-10-15 20:37:34.346667-04
227 | 2018-10-15 20:37:47.008137-04 | 2018-10-16 07:39:00.29917-04
228 | 2018-10-16 07:39:47.012411-04 | 2018-10-16 08:16:01.470232-04
229 | 2018-10-16 08:16:47.018899-04 | 2018-10-16 08:21:13.854348-04
230 | 2018-10-16 08:21:47.013767-04 | 2018-10-17 12:21:09.224094-04
231 | 2018-10-17 12:21:09.23193-04 | 2018-10-17 15:11:59.338777-04
另请参阅
22 - FAULT_GROUPS
查看容错组和它们在群集中的层次结构。
示例
显示群集中的容错组的当前层次结构:
vmartdb=> SELECT member_type, member_name, parent_type, CASE
WHEN parent_type = 'DATABASE' THEN ''
ELSE parent_name END FROM fault_groups
ORDER BY member_name;
member_type | member_name | parent_type | parent_name
-------------+-----------------------+-------------+-------------
NODE | v_vmart_node0001 | FAULT GROUP | two
NODE | v_vmart_node0002 | FAULT GROUP | two
NODE | v_vmart_node0003 | FAULT GROUP | three
FAULT GROUP | one | DATABASE |
FAULT GROUP | three | DATABASE |
FAULT GROUP | two | FAULT GROUP | one
查看区段布局的分布:
vmartdb=> SELECT segment_layout from elastic_cluster;
segment_layout
-------------------------------------------------------------------------
v_vmart_node0001[33.3%] v_vmart_node0003[33.3%] v_vmart_node0004[33.3%]
(1 row)
另请参阅
23 - FOREIGN_KEYS
提供外键信息。
示例
mydb=> SELECT
constraint_name,
table_name,
ordinal_position,
reference_table_name
FROM foreign_keys ORDER BY 3;
constraint_name | table_name | ordinal_position | reference_table_name
---------------------------+-------------------+------------------+-----------------------
fk_store_sales_date | store_sales_fact | 1 | date_dimension
fk_online_sales_saledate | online_sales_fact | 1 | date_dimension
fk_store_orders_product | store_orders_fact | 1 | product_dimension
fk_inventory_date | inventory_fact | 1 | date_dimension
fk_inventory_product | inventory_fact | 2 | product_dimension
fk_store_sales_product | store_sales_fact | 2 | product_dimension
fk_online_sales_shipdate | online_sales_fact | 2 | date_dimension
fk_store_orders_product | store_orders_fact | 2 | product_dimension
fk_inventory_product | inventory_fact | 3 | product_dimension
fk_store_sales_product | store_sales_fact | 3 | product_dimension
fk_online_sales_product | online_sales_fact | 3 | product_dimension
fk_store_orders_store | store_orders_fact | 3 | store_dimension
fk_online_sales_product | online_sales_fact | 4 | product_dimension
fk_inventory_warehouse | inventory_fact | 4 | warehouse_dimension
fk_store_orders_vendor | store_orders_fact | 4 | vendor_dimension
fk_store_sales_store | store_sales_fact | 4 | store_dimension
fk_store_orders_employee | store_orders_fact | 5 | employee_dimension
fk_store_sales_promotion | store_sales_fact | 5 | promotion_dimension
fk_online_sales_customer | online_sales_fact | 5 | customer_dimension
fk_store_sales_customer | store_sales_fact | 6 | customer_dimension
fk_online_sales_cc | online_sales_fact | 6 | call_center_dimension
fk_store_sales_employee | store_sales_fact | 7 | employee_dimension
fk_online_sales_op | online_sales_fact | 7 | online_page_dimension
fk_online_sales_shipping | online_sales_fact | 8 | shipping_dimension
fk_online_sales_warehouse | online_sales_fact | 9 | warehouse_dimension
fk_online_sales_promotion | online_sales_fact | 10 | promotion_dimension
(26 rows)
24 - GRANTS
返回在数据库对象上显式授予的权限的相关信息。不包括继承的权限的相关信息。
示例
以下查询显示授予用户 Rob 或角色 R1 的权限。权限附有星号 (*) 表示用户可以将此权限授予其他用户:
=> SELECT grantor,privileges_description,object_name,object_type,grantee FROM grants WHERE grantee='Rob' OR grantee='R1';
grantor | privileges_description | object_name | object_type | grantee
--------+---------------------------+-------------+--------------+---------
dbadmin | USAGE | general | RESOURCEPOOL | Rob
dbadmin | USAGE, CREATE | s1 | SCHEMA | Rob
dbadmin | INSERT*, SELECT*, UPDATE* | t1 | TABLE | Rob
dbadmin | SELECT | t1 | TABLE | R1
dbadmin | USAGE | s1 | SCHEMA | R1
dbadmin | | R1 | ROLE | Rob
(6 rows)
另请参阅
25 - HCATALOG_COLUMNS
介绍可以通过 HCatalog 连接器使用的所有表的列。此表中的每个行都对应可以通过 HCatalog 连接器访问的表中的列。有关详细信息,请参阅使用 HCatalog 连接器。
特权
不需要显式权限;但是,用户只会看到与他们有权访问的架构对应的记录。
注意
如果使用的是 WebHCat 而非 HiveServer2,则查询此表会导致一个 web 服务对每个 HCatalog 架构中的每个表调用 WebHCat 服务器。如果需要在短时间内对此表执行多次查询,请考虑使用 CREATE TABLE AS 语句创建表的副本,以便提高性能。副本不会反映创建 Hive 表的架构之后对它所做的任何更改,但查询速度会快很多。
示例
以下示例展示了如何查找特定表的列信息:
=> SELECT * FROM HCATALOG_COLUMNS WHERE table_name = 'hcatalogtypes'
-> ORDER BY ordinal_position;
-[ RECORD 1 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | intcol
hcatalog_data_type | int
data_type | int
data_type_id | 6
data_type_length | 8
character_maximum_length |
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 1
-[ RECORD 2 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | floatcol
hcatalog_data_type | float
data_type | float
data_type_id | 7
data_type_length | 8
character_maximum_length |
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 2
-[ RECORD 3 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | doublecol
hcatalog_data_type | double
data_type | float
data_type_id | 7
data_type_length | 8
character_maximum_length |
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 3
-[ RECORD 4 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | charcol
hcatalog_data_type | string
data_type | varchar(65000)
data_type_id | 9
data_type_length | 65000
character_maximum_length | 65000
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 4
-[ RECORD 5 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | varcharcol
hcatalog_data_type | string
data_type | varchar(65000)
data_type_id | 9
data_type_length | 65000
character_maximum_length | 65000
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 5
-[ RECORD 6 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | boolcol
hcatalog_data_type | boolean
data_type | boolean
data_type_id | 5
data_type_length | 1
character_maximum_length |
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 6
-[ RECORD 7 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | timestampcol
hcatalog_data_type | string
data_type | varchar(65000)
data_type_id | 9
data_type_length | 65000
character_maximum_length | 65000
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 7
-[ RECORD 8 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | varbincol
hcatalog_data_type | binary
data_type | varbinary(65000)
data_type_id | 17
data_type_length | 65000
character_maximum_length | 65000
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 8
-[ RECORD 9 ]------------+-----------------
table_schema | hcat
hcatalog_schema | default
table_name | hcatalogtypes
is_partition_column | f
column_name | bincol
hcatalog_data_type | binary
data_type | varbinary(65000)
data_type_id | 17
data_type_length | 65000
character_maximum_length | 65000
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 9
另请参阅
26 - HCATALOG_SCHEMATA
列出使用 HCatalog 连接器定义的所有架构。请参阅使用 HCatalog 连接器。
与 HCatalog 连接器相关的其他系统表不同,此表不调用 Hive,因此查询非常轻松。
特权
不需要显式权限;但是,用户只会看到与他们有权访问的架构对应的记录。
另请参阅
27 - HCATALOG_TABLES
返回可以通过 HCatalog 连接器使用的所有表的详细列表。请参阅使用 HCatalog 连接器。
特权
不需要显式权限;但是,用户只会看到与他们有权访问的架构对应的记录。
另请参阅
28 - HCATALOG_TABLE_LIST
所有 Hive 架构和数据库中包含的可以通过 HCatalog 连接器使用的所有列表的简明列表。请参阅使用 HCatalog 连接器。
特权
不需要显式权限;但是,用户只会看到与他们有权访问的架构对应的记录。
注意
-
查询此表会导致针对使用 HCatalog 连接器定义的每个 Hive 架构调用一次 HiveServer2。这意味着查询需要的时间通常比查询其他系统表更久。
-
查询此表比查询 HCATALOG_TABLES 更快。查询 HCATALOG_TABLE_LIST 仅针对每个 HCatalog 架构调用一次 HiveServer2,而查询 HCATALOG_TABLES 的每个表都会调用一次。
示例
以下示例演示了定义新 HCatalog 架构,然后查询 HCATALOG_TABLE_LIST。请注意,也会显示在其他 HCatalog 架构中定义的表。HCATALOG_TABLE_LIST 列出任何一个 HCatalog 架构中可用的所有表:
=> CREATE HCATALOG SCHEMA hcat WITH hostname='hcathost'
-> HCATALOG_SCHEMA='default' HCATALOG_DB='default' HCATALOG_USER='hcatuser';
CREATE SCHEMA
=> \x
Expanded display is on.
=> SELECT * FROM v_catalog.hcatalog_table_list;
-[ RECORD 1 ]------+------------------
table_schema_id | 45035996273748980
table_schema | hcat
hcatalog_schema | default
table_name | weblogs
hcatalog_user_name | hcatuser
-[ RECORD 2 ]------+------------------
table_schema_id | 45035996273748980
table_schema | hcat
hcatalog_schema | default
table_name | tweets
hcatalog_user_name | hcatuser
-[ RECORD 3 ]------+------------------
table_schema_id | 45035996273748980
table_schema | hcat
hcatalog_schema | default
table_name | messages
hcatalog_user_name | hcatuser
-[ RECORD 4 ]------+------------------
table_schema_id | 45035996273864948
table_schema | hiveschema
hcatalog_schema | default
table_name | weblogs
hcatalog_user_name | hcatuser
另请参阅
29 - INHERITING_OBJECTS
提供哪些表和视图从哪些架构继承权限的相关信息。
有关从架构及其关联的 GRANT 语句继承的特定权限的信息,请参阅 INHERITED_PRIVILEGES 表。
示例
以下查询返回从父架构(即客户)继承其权限的表和视图。
=> SELECT * FROM inheriting_objects WHERE object_schema='customers';
object_id | schema_id | object_schema | object_name | object_type
------------------+-------------------+---------------+---------------+-------------
45035996273980908 | 45035996273980902 | customers | cust_info | table
45035996273980984 | 45035996273980902 | customers | shipping_info | table
45035996273980980 | 45035996273980902 | customers | cust_set | view
(3 rows)
另请参阅
30 - INHERITED_PRIVILEGES
提供有关父架构上的表和视图通过 GRANT 语句继承的权限的摘要信息,不包括继承的授权选项。
有关显式授予权限的信息,请参阅系统表 GRANTS。
注意
如果在数据库级别禁用权限继承,则不会显示所继承的权限。示例
以下查询返回表和视图从其父架构(即客户)继承的权限。
=> SELECT object_schema,object_name,object_type,privileges_description,principal,grantor FROM inherited_privileges WHERE object_schema='customers';
object_schema | object_name | object_type | privileges_description | principal | grantor
--------------+---------------+-------------+---------------------------------------------------------------------------+-----------+---------
customers | cust_info | Table | INSERT, SELECT, UPDATE, DELETE, ALTER, REFERENCES, DROP, TRUNCATE | dbadmin | dbadmin
customers | shipping_info | Table | INSERT, SELECT, UPDATE, DELETE, ALTER, REFERENCES, DROP, TRUNCATE | dbadmin | dbadmin
customers | cust_set | View | SELECT, ALTER, DROP | dbadmin | dbadmin
customers | cust_info | Table | SELECT | Val | dbadmin
customers | shipping_info | Table | SELECT | Val | dbadmin
customers | cust_set | View | SELECT | Val | dbadmin
customers | cust_info | Table | INSERT | Pooja | dbadmin
customers | shipping_info | Table | INSERT | Pooja | dbadmin
(8 rows)
另请参阅
31 - KEYWORDS
识别 Vertica 保留关键字和非保留关键字。
示例
以下查询将获取所有以 B 开头的保留关键字:
=> SELECT * FROM keywords WHERE reserved = 'R' AND keyword ilike 'B%';
keyword | reserved
---------+----------
BETWEEN | R
BIGINT | R
BINARY | R
BIT | R
BOOLEAN | R
BOTH | R
(6 rows)
另请参阅
关键字34 - LICENSES
显示所有许可证的类型信息、许可证有效日期以及许可证强加限制。
35 - LOAD_BALANCE_GROUPS
列出所有负载均衡组包含的对象。此表中的每一行代表负载均衡组中的一个对象。如果负载均衡组不包含任何对象,则将会在此表中出现一次,其类型列设置为“Empty Group”。
示例
=> SELECT * FROM LOAD_BALANCE_GROUPS;
name | policy | filter | type | object_name
---------------+------------+-----------+-----------------------+-------------
group_1 | ROUNDROBIN | | Network Address Group | node01
group_1 | ROUNDROBIN | | Network Address Group | node02
group_2 | ROUNDROBIN | | Empty Group |
group_all | ROUNDROBIN | | Network Address Group | node01
group_all | ROUNDROBIN | | Network Address Group | node02
group_all | ROUNDROBIN | | Network Address Group | node03
group_fault_1 | RANDOM | 0.0.0.0/0 | Fault Group | fault_1
(7 rows)
另请参阅
36 - LOG_PARAMS
提供与数据库中运行的身份验证和安全相关的配置参数更改的摘要信息。
示例
以下示例将查询 LOG_PARAMS 系统表并仅显示此用户在“身份验证 (Authentication)”类别下的最新配置参数:
=> SELECT * FROM log_params limit 1;
--------------------------------------------------------------------------------------------------------
issued_time | 2018-02-12 13:41:20.837452-05
user_name | dbadmin
user_id | 45035996273704962
hostname | ::1:50690
session_id | v_vmart_node0001-341751:0x13878
audit_type | Param
audit_tag_name| SecurityAlgorithm
request_type | UTILITY
request_id | 8
subject | MD5
request | select set_config_parameter('SecurityAlgorithm','MD5',null);
success | t
category | Authentication
(1 row)
37 - LOG_QUERIES
提供与在数据库中运行的身份验证和安全相关的一些查询的摘要信息。
示例
以下示例将查询 LOG_QUERIES 系统表并仅显示该用户在 Managing_Users_Privileges 类别下的最新查询:
=> SELECT * FROM log_queries limit 1;
---------------------------------------------------------------------------
issued_time | 2018-01-22 10:36:55.634349-05
user_name | dbadmin
user_id | 45035996273704962
hostname |
session_id | v_vmart_node0001-237210:0x37e1d
audit_type | Query
audit_tag_name| REVOKE ROLE
request_type | DDL
request_id | 2
subject |
request | revoke all privileges from Joe;
success | f
category | Managing_Users_Privileges
(1 row)
38 - LOG_TABLES
提供有关系统表查询的摘要信息。
示例
以下示例显示了对配置参数的最新查询:
dbadmin=> SELECT issued_time, audit_type, request_type, subject, request, category FROM log_tables
WHERE category ilike '%Managing_Config_Parameters%' ORDER BY issued_time DESC LIMIT 4;
-[ RECORD 1 ]+-------------------------------------------------------------------------------------
issued_time | 2020-05-14 14:14:53.453552-04
audit_type | Table
request_type | QUERY
subject | vs_nodes
request | SELECT * from vs_nodes order by name limit 1;
category | Managing_Config_Parameters
-[ RECORD 2 ]+-------------------------------------------------------------------------------------
issued_time | 2020-05-14 14:14:27.546474-04
audit_type | Table
request_type | QUERY
subject | vs_nodes
request | SELECT * from vs_nodes order by name ;
category | Managing_Config_Parameters
-[ RECORD 3 ]+-------------------------------------------------------------------------------------
issued_time | 2020-05-14 08:54:32.86881-04
audit_type | Table
request_type | QUERY
subject | vs_parameters_mismatch
request | select * from configuration_parameters where parameter_name = 'MaxDepotSizePercent';
category | Managing_Config_Parameters
-[ RECORD 4 ]+-------------------------------------------------------------------------------------
issued_time | 2020-05-14 08:54:32.86881-04
audit_type | Table
request_type | QUERY
subject | vs_nodes
request | select * from configuration_parameters where parameter_name = 'MaxDepotSizePercent';
category | Managing_Config_Parameters
39 - MATERIALIZE_FLEXTABLE_COLUMNS_RESULTS
运行 flex 表函数以后,返回结果, MATERIALIZE_FLEXTABLE_COLUMNS。系统表包含以下信息:
示例
=> SELECT table_name, creation_time, key_name, status, message FROM v_catalog.materialize_flextable_columns_results WHERE table_name = 'twitter_r'; table_name | creation_time | key_name | status | message ------------+-------------------------------+-------------------+--------+-------------------------------------------------------- twitter_r | 2013-11-20 17:00:27.945484-05 | contributors | ADDED | Added successfully twitter_r | 2013-11-20 17:00:27.94551-05 | entities.hashtags | ADDED | Added successfully twitter_r | 2013-11-20 17:00:27.945519-05 | entities.urls | ADDED | Added successfully twitter_r | 2013-11-20 17:00:27.945532-05 | created_at | EXISTS | Column of same name already exists in table definition (4 rows
40 - MODELS
列出数据库中机器学习模型的详细信息。
示例
=> SELECT * FROM models;
-[ RECORD 1 ]------------------------------
model_id | 45035996273714020
model_name | myLinearRegModel
schema_id | 45035996273704980
schema_name | public
owner_id | 45035996273704962
owner_name | dbadmin
category | VERTICA_MODELS
model_type | LINEAR_REGRESSION
is_complete | t
create_time | 2018-01-22 11:13:35.018412-05
size | 1671
41 - NETWORK_ADDRESSES
列出使用 CREATE NETWORK ADDRESS 语句在数据库中定义的网络地址的相关信息。
示例
=> \x
Expanded display is on.
=> SELECT * FROM v_catalog.network_addresses;
-[ RECORD 1 ]----+-----------------
name | node01
node | v_vmart_node0001
address | 10.20.100.247
port | 5433
address_family | ipv4
is_enabled | t
is_auto_detected | f
-[ RECORD 2 ]----+-----------------
name | node02
node | v_vmart_node0002
address | 10.20.100.248
port | 5433
address_family | ipv4
is_enabled | t
is_auto_detected | f
-[ RECORD 3 ]----+-----------------
name | node03
node | v_vmart_node0003
address | 10.20.100.249
port | 5433
address_family | ipv4
is_enabled | t
is_auto_detected | f
另请参阅
42 - NODES
数据库节点的列表详情。
示例
=> SELECT NODE_NAME, NODE_STATE, IS_PRIMARY, IS_READONLY, NODE_TYPE,
SUBCLUSTER_NAME FROM NODES ORDER BY NODE_NAME ASC;
NODE_NAME | NODE_STATE | IS_PRIMARY | IS_READONLY | NODE_TYPE | SUBCLUSTER_NAME
----------------------+------------+------------+-------------+-----------+--------------------
v_verticadb_node0001 | UP | t | f | PERMANENT | default_subcluster
v_verticadb_node0002 | UP | t | f | PERMANENT | default_subcluster
v_verticadb_node0003 | UP | t | f | PERMANENT | default_subcluster
v_verticadb_node0004 | UP | f | f | PERMANENT | analytics
v_verticadb_node0005 | UP | f | f | PERMANENT | analytics
v_verticadb_node0006 | UP | f | f | PERMANENT | analytics
(6 rows)
43 - NODE_SUBSCRIPTION_CHANGE_PHASES
在 Eon 模式数据库中,存储有关节点分片订阅更改的信息。
示例
=> SELECT NODE_NAME, SUBSCRIPTION_CHANGE_TYPE, SHARD_NAME,
ACTION FROM node_subscription_change_phases
ORDER BY start_time ASC LIMIT 10;
NODE_NAME | SUBSCRIPTION_CHANGE_TYPE | SHARD_NAME | ACTION
----------------------+--------------------------+-------------+------------------------
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0007 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0010 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0004 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0005 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | replica | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0005 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0006 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0008 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0011 | COLLECT SHARD METADATA
v_verticadb_node0001 | CREATE SUBSCRIPTION | segment0002 | COLLECT SHARD METADATA
44 - NODE_SUBSCRIPTIONS
仅限 Eon 模式
列出有关数据库节点订阅分片的信息。
示例
以下示例将查询数据库中的 NODE_SUBSCRIPTIONS 表,该数据库包含 12 个分片,有 2 个三节点子群集(一个主子群集,一个辅助子群集)。
=> SELECT node_name, shard_name, subscription_state, is_primary,
is_participating_primary AS is_p_primary
FROM NODE_SUBSCRIPTIONS ORDER BY node_name, shard_name;
node_name | shard_name | subscription_state | is_primary | is_p_primary
----------------------+-------------+--------------------+------------+--------------
v_verticadb_node0001 | replica | ACTIVE | t | t
v_verticadb_node0001 | segment0001 | ACTIVE | t | t
v_verticadb_node0001 | segment0003 | ACTIVE | f | f
v_verticadb_node0001 | segment0004 | ACTIVE | t | t
v_verticadb_node0001 | segment0006 | ACTIVE | f | f
v_verticadb_node0001 | segment0007 | ACTIVE | t | t
v_verticadb_node0001 | segment0009 | ACTIVE | f | f
v_verticadb_node0001 | segment0010 | ACTIVE | t | t
v_verticadb_node0001 | segment0012 | ACTIVE | f | f
v_verticadb_node0002 | replica | ACTIVE | f | t
v_verticadb_node0002 | segment0001 | ACTIVE | f | f
v_verticadb_node0002 | segment0002 | ACTIVE | t | t
v_verticadb_node0002 | segment0004 | ACTIVE | f | f
v_verticadb_node0002 | segment0005 | ACTIVE | t | t
v_verticadb_node0002 | segment0007 | ACTIVE | f | f
v_verticadb_node0002 | segment0008 | ACTIVE | t | t
v_verticadb_node0002 | segment0010 | ACTIVE | f | f
v_verticadb_node0002 | segment0011 | ACTIVE | t | t
v_verticadb_node0003 | replica | ACTIVE | f | t
v_verticadb_node0003 | segment0002 | ACTIVE | f | f
v_verticadb_node0003 | segment0003 | ACTIVE | t | t
v_verticadb_node0003 | segment0005 | ACTIVE | f | f
v_verticadb_node0003 | segment0006 | ACTIVE | t | t
v_verticadb_node0003 | segment0008 | ACTIVE | f | f
v_verticadb_node0003 | segment0009 | ACTIVE | t | t
v_verticadb_node0003 | segment0011 | ACTIVE | f | f
v_verticadb_node0003 | segment0012 | ACTIVE | t | t
v_verticadb_node0004 | replica | ACTIVE | f | t
v_verticadb_node0004 | segment0001 | ACTIVE | f | t
v_verticadb_node0004 | segment0003 | ACTIVE | f | f
v_verticadb_node0004 | segment0004 | ACTIVE | f | t
v_verticadb_node0004 | segment0006 | ACTIVE | f | f
v_verticadb_node0004 | segment0007 | ACTIVE | f | t
v_verticadb_node0004 | segment0009 | ACTIVE | f | f
v_verticadb_node0004 | segment0010 | ACTIVE | f | t
v_verticadb_node0004 | segment0012 | ACTIVE | f | f
v_verticadb_node0005 | replica | ACTIVE | f | t
v_verticadb_node0005 | segment0001 | ACTIVE | f | f
v_verticadb_node0005 | segment0002 | ACTIVE | f | t
v_verticadb_node0005 | segment0004 | ACTIVE | f | f
v_verticadb_node0005 | segment0005 | ACTIVE | f | t
v_verticadb_node0005 | segment0007 | ACTIVE | f | f
v_verticadb_node0005 | segment0008 | ACTIVE | f | t
v_verticadb_node0005 | segment0010 | ACTIVE | f | f
v_verticadb_node0005 | segment0011 | ACTIVE | f | t
v_verticadb_node0006 | replica | ACTIVE | f | t
v_verticadb_node0006 | segment0002 | ACTIVE | f | f
v_verticadb_node0006 | segment0003 | ACTIVE | f | t
v_verticadb_node0006 | segment0005 | ACTIVE | f | f
v_verticadb_node0006 | segment0006 | ACTIVE | f | t
v_verticadb_node0006 | segment0008 | ACTIVE | f | f
v_verticadb_node0006 | segment0009 | ACTIVE | f | t
v_verticadb_node0006 | segment0011 | ACTIVE | f | f
v_verticadb_node0006 | segment0012 | ACTIVE | f | t
(54 rows)
45 - ODBC_COLUMNS
提供表列信息。该格式由 ODBC SQLColumns 元数据的 ODBC 标准定义。ODBC 规范中提供了有关 ODBC SQLColumns 格式的详细信息:http://msdn.microsoft.com/en-us/library/windows/desktop/ms711683%28v=vs.85%29.aspx。
47 - PASSWORDS
包含当前用户密码的相关信息。如果任何 配置文件 设置了 PASSWORD_REUSE_TIME
或 PASSWORD_REUSE_MAX
参数,此表还将包括过去密码的相关信息。有关详细信息,请参阅CREATE PROFILE。
示例
以下查询返回了用户“u1”的 SHA-512 哈希密码和 salt。
=> SELECT user_name, password, salt FROM passwords WHERE user_name='u1';
user_name | password | salt
-----------+--------------------------------------------------------+----------------------------------
u1 | sha512f3f802f1c56e2530cd9c3164cc7b8002ba444c0834160f10 | f05e9d859fb441f9f612f8a787bfc872
(1 row)
48 - PRIMARY_KEYS
提供主键的信息。
49 - PROFILE_PARAMETERS
定义存储在配置文件中的信息。
51 - PROJECTION_CHECKPOINT_EPOCHS
提供有关检查点时期的详细信息,仅适用于 Enterprise 模式。
特权
非超级用户:不需要任何显式权限。您只会看到您有权查看的表的记录。
示例
=> SELECT node_name, projection_schema, projection_name, is_up_to_date, checkpoint_epoch FROM projection_checkpoint_epochs
WHERE projection_name ilike 't1_b%' ORDER BY projection_name, node_name;
node_name | projection_schema | projection_name | is_up_to_date | checkpoint_epoch
------------------+-------------------+-----------------+---------------+------------------
v_vmart_node0001 | public | t1_b1 | t | 965
v_vmart_node0002 | public | t1_b1 | t | 965
v_vmart_node0003 | public | t1_b1 | t | 965
v_vmart_node0001 | public | t1_b0 | t | 965
v_vmart_node0002 | public | t1_b0 | t | 965
v_vmart_node0003 | public | t1_b0 | t | 965
(6 rows)
dbadmin=> INSERT INTO t1 VALUES (100, 101, 102);
OUTPUT
--------
1
(1 row)
dbadmin=> COMMIT;
COMMIT
dbadmin=> SELECT node_name, projection_schema, projection_name, is_up_to_date, checkpoint_epoch FROM projection_checkpoint_epochs
WHERE projection_name ILIKE 't1_b%' ORDER BY projection_name, node_name;
node_name | projection_schema | projection_name | is_up_to_date | checkpoint_epoch
------------------+-------------------+-----------------+---------------+------------------
v_vmart_node0001 | public | t1_b1 | t | 966
v_vmart_node0002 | public | t1_b1 | t | 966
v_vmart_node0003 | public | t1_b1 | t | 966
v_vmart_node0001 | public | t1_b0 | t | 966
v_vmart_node0002 | public | t1_b0 | t | 966
v_vmart_node0003 | public | t1_b0 | t | 966
(6 rows)
52 - PROJECTION_COLUMNS
提供投影列的相关信息,例如编码类型、排序顺序、统计信息类型以及列统计信息的上次更新时间。
示例
请参阅 PROJECTION_COLUMNS 中的统计信息数据
另请参阅
53 - PROJECTION_DELETE_CONCERNS
列出其设计在删除数据时可能导致性能问题的投影。此表是通过调用 EVALUATE_DELETE_PERFORMANCE 函数生成的。有关详细信息,请参阅优化 DELETE 和 UPDATE。
55 - RESOURCE_POOL_DEFAULTS
返回内置和用户定义的资源池的默认参数设置。使用
ALTER RESOURCE POOL
将资源池参数还原为默认设置。
有关内置资源池的有效参数及其默认设置的信息,请参阅 内置资源池配置。
要获取资源池的当前设置,请查询系统表
RESOURCE_POOLS
。
特权
无
58 - ROUTING_RULES
列出将传入 IP 地址映射到负载均衡组的路由规则。
示例
=> SELECT * FROM routing_rules;
-[ RECORD 1 ]----+-----------------
name | internal_clients
source_address | 192.168.1.0/24
destination_name | group_1
-[ RECORD 2 ]----+-----------------
name | etl_rule
source_address | 10.20.100.0/24
destination_name | group_2
-[ RECORD 3 ]----+-----------------
name | subnet_192
source_address | 192.0.0.0/8
destination_name | group_all
-[ RECORD 4 ]----+--------------
name | all_ipv6
source_address | 0::0/0
destination_name | default_ipv6
另请参阅
59 - SCHEMATA
提供有关数据库中架构的信息。
特权
非超级用户:不需要任何显式权限。您只会看到您有权查看的表的记录。
60 - SEQUENCES
显示有关序列的信息。
示例
创建简单的序列:
=> CREATE SEQUENCE my_seq MAXVALUE 5000 START 150;
CREATE SEQUENCE
返回有关刚创建的序列的信息:
=> \x
Expanded display is on.
=> SELECT * FROM sequences;
-[ RECORD 1 ]-------+------------------
sequence_schema | public
sequence_name | my_seq
owner_name | dbadmin
identity_table_name |
session_cache_count | 250000
allow_cycle | f
output_ordered | f
increment_by | 1
minimum | 1
maximum | 5000
current_value | 149
sequence_schema_id | 45035996273704966
sequence_id | 45035996273844996
owner_id | 45035996273704962
identity_table_id | 0
标识列是仅适用于数字列类型的序列。要识别表中的列(如有)是标识列,请搜索 COLUMNS
表以查找表中的标识列:
=> CREATE TABLE testid (c1 IDENTITY(1, 1, 1000), c2 INT);
=> \x
Expanded display is on.
=> SELECT * FROM COLUMNS WHERE is_identity='t' AND table_name='testid';
-[ RECORD 1 ]------------+------------------
table_id | 45035996274150730
table_schema | public
table_name | testid
is_system_table | f
column_name | c1
data_type | int
data_type_id | 6
data_type_length | 8
character_maximum_length |
numeric_precision |
numeric_scale |
datetime_precision |
interval_precision |
ordinal_position | 1
is_nullable | f
column_default |
is_identity | t
使用 SEQUENCES
表获得关于 testid 中序列的详细信息:
=> SELECT * FROM sequences WHERE identity_table_name='testid';
-[ RECORD 1 ]-------+--------------------
sequence_schema | public
sequence_name | testid_c1_seq
owner_name | dbadmin
identity_table_name | testid
session_cache_count | 1000
allow_cycle | f
output_ordered | f
increment_by | 1
minimum | 1
maximum | 9223372036854775807
current_value | 0
sequence_schema_id | 45035996273704976
sequence_id | 45035996274150770
owner_id | 45035996273704962
identity_table_id | 45035996274150768
使用 vsql 命令 \ds
以返回序列的列表。以下结果显示了先前示例中创建的两个序列。如果存在更多序列,表会将其列出。
新序列的 CurrentValue 比您在 CREATE SEQUENCE
和 IDENTITY
命令中指定的起始编号少 1,因为您还未使用 NEXTVAL 实例化序列来分配其缓存或提供其首批初始值。
=> \ds
List of Sequences
-[ RECORD 1 ]+--------------------
Schema | public
Sequence | my_seq
CurrentValue | 149
IncrementBy | 1
Minimum | 1
Maximum | 5000
AllowCycle | f
Comment |
-[ RECORD 2 ]+--------------------
Schema | public
Sequence | testid_c1_seq
CurrentValue | 0
IncrementBy | 1
Minimum | 1
Maximum | 9223372036854775807
AllowCycle | f
Comment |
61 - SESSION_SUBSCRIPTIONS
在 Eon 模式数据库中,列出所有节点的分片订阅,以及订阅是否用于解析当前会话的查询。将参与解析此会话查询的节点在其 IS_PARTICIPATING 列中显示为 TRUE。
示例
以下示例列出了参与当前会话或在其中协作的订阅:
=> SELECT node_name, shard_name, is_collaborating, is_participating
FROM V_CATALOG.SESSION_SUBSCRIPTIONS
WHERE is_participating = TRUE OR is_collaborating = TRUE
ORDER BY shard_name, node_name;
node_name | shard_name | is_collaborating | is_participating
----------------------+-------------+------------------+------------------
v_verticadb_node0004 | replica | f | t
v_verticadb_node0005 | replica | f | t
v_verticadb_node0006 | replica | t | f
v_verticadb_node0007 | replica | f | t
v_verticadb_node0008 | replica | t | f
v_verticadb_node0009 | replica | t | f
v_verticadb_node0007 | segment0001 | f | t
v_verticadb_node0008 | segment0001 | t | f
v_verticadb_node0005 | segment0002 | f | t
v_verticadb_node0009 | segment0002 | t | f
v_verticadb_node0004 | segment0003 | f | t
v_verticadb_node0006 | segment0003 | t | f
(12 rows)
62 - SHARDS
列出数据库中的分片。
示例
=> SELECT * FROM SHARDS;
-[ RECORD 1 ]----+------------------
shard_oid | 45035996273704980
shard_name | replica
shard_type | Replica
lower_hash_bound |
upper_hash_bound |
is_replicated | t
has_objects | t
...
63 - STORAGE_LOCATIONS
提供有关存储位置(包括 ID、标签和状态)的信息。
特权
超级用户
另请参阅
64 - SUBCLUSTERS
此表列出了数据库中定义的所有子群集。它包含数据库中每个节点的条目,其中列出了每个条目所属的子群集。任何不包含节点的子群集在此表中都有一个条目,其中 NODE_NAME 和 NODE_OID 列为空。此表仅在数据库在 Eon 模式下运行时才会填充。
示例
=> \x
Expanded display is on.
dbadmin=> SELECT * FROM SUBCLUSTERS;
-[ RECORD 1 ]----+---------------------
subcluster_oid | 45035996273704978
subcluster_name | default_subcluster
node_oid | 45035996273704982
node_name | v_verticadb_node0001
parent_oid | 45035996273704976
parent_name | verticadb
is_default | t
is_primary | t
control_set_size | -1
-[ RECORD 2 ]----+---------------------
subcluster_oid | 45035996273704978
subcluster_name | default_subcluster
node_oid | 45035996273840970
node_name | v_verticadb_node0002
parent_oid | 45035996273704976
parent_name | verticadb
is_default | t
is_primary | t
control_set_size | -1
-[ RECORD 3 ]----+---------------------
subcluster_oid | 45035996273704978
subcluster_name | default_subcluster
node_oid | 45035996273840974
node_name | v_verticadb_node0003
parent_oid | 45035996273704976
parent_name | verticadb
is_default | t
is_primary | t
control_set_size | -1
另请参阅
65 - SUBCLUSTER_RESOURCE_POOL_OVERRIDES
显示内置全局资源池设置的子群集级别覆盖。
67 - SYSTEM_TABLES
返回所有系统表名称的列表。
69 - TABLES
提供有关数据库中所有表格的信息。
提示
TABLE_SCHEMA
和 TABLE_NAME
列区分大小写。要查询这些列上的 TABLES
,请使用不区分大小写的 ILIKE
谓词。例如:
SELECT table_schema, table_name FROM v_catalog.tables WHERE table_schema ILIKE 'Store%';
示例
查找表的创建时间:
=> SELECT table_schema, table_name, create_time FROM tables;
table_schema | table_name | create_time
--------------+-----------------------+-------------------------------
public | customer_dimension | 2011-08-15 11:18:25.784203-04
public | product_dimension | 2011-08-15 11:18:25.815653-04
public | promotion_dimension | 2011-08-15 11:18:25.850592-04
public | date_dimension | 2011-08-15 11:18:25.892347-04
public | vendor_dimension | 2011-08-15 11:18:25.942805-04
public | employee_dimension | 2011-08-15 11:18:25.966985-04
public | shipping_dimension | 2011-08-15 11:18:25.999394-04
public | warehouse_dimension | 2011-08-15 11:18:26.461297-04
public | inventory_fact | 2011-08-15 11:18:26.513525-04
store | store_dimension | 2011-08-15 11:18:26.657409-04
store | store_sales_fact | 2011-08-15 11:18:26.737535-04
store | store_orders_fact | 2011-08-15 11:18:26.825801-04
online_sales | online_page_dimension | 2011-08-15 11:18:27.007329-04
online_sales | call_center_dimension | 2011-08-15 11:18:27.476844-04
online_sales | online_sales_fact | 2011-08-15 11:18:27.49749-04
(15 rows)
查明某些表是否为临时表和 flex 表:
=> SELECT distinct table_name, table_schema, is_temp_table, is_flextable FROM v_catalog.tables
WHERE table_name ILIKE 't%';
table_name | table_schema | is_temp_table | is_flextable
--------------+--------------+---------------+-----------------
t2_temp | public | t | t
tt_keys | public | f | f
t2_temp_keys | public | f | f
t3 | public | t | f
t1 | public | f | f
t9_keys | public | f | f
t2_keys | public | f | t
t6 | public | t | f
t5 | public | f | f
t2 | public | f | t
t8 | public | f | f
t7 | public | t | f
tt | public | t | t
t2_keys_keys | public | f | f
t9 | public | t | t
(15 rows)
70 - TEXT_INDICES
提供有关 Vertica 中文本索引的摘要信息。
74 - USER_CONFIGURATION_PARAMETERS
提供对数据库用户有效的用户级别配置参数的相关信息。
特权
仅限超级用户
示例
=> SELECT * FROM user_configuration_parameters;
user_name | parameter_name | current_value | default_value
-----------+---------------------------+---------------+---------------
Yvonne | LoadSourceStatisticsLimit | 512 | 256
(1 row)
=> ALTER USER Ahmed SET DepotOperationsForQuery='FETCHES';
ALTER USER
=> ALTER USER Yvonne SET DepotOperationsForQuery='FETCHES';
ALTER USER
=> SELECT * FROM user_configuration_parameters;
user_name | parameter_name | current_value | default_value
-----------+---------------------------+---------------+---------------
Ahmed | DepotOperationsForQuery | FETCHES | ALL
Yvonne | DepotOperationsForQuery | FETCHES | ALL
Yvonne | LoadSourceStatisticsLimit | 512 | 256
(3 rows)
75 - USER_FUNCTION_PARAMETERS
提供 C++ 用户定义函数 (UDx) 的参数的相关信息。您只能查看那些 Properties.visible
属性已设置为 TRUE
的参数。
特权
任何用户都可查询 USER_FUNCTION_PARAMETERS 表。但是,用户只能看到其拥有使用权限的 UDx 函数的相关表信息。
另请参阅
76 - USER_FUNCTIONS
返回用户定义的 SQL 函数(将常用的 SQL 表达式作为函数存储在 Vertica 编录中)和用户定义函数的相关元数据。
注意
-
将根据函数定义自动推断出 SQL 函数的可变性和严格性,以便 Vertica 确定使用的正确性,比如在应该提供不可变函数时却提供了易变函数。
-
UDx 的可变性和严格性由 UDx 开发者予以定义。
示例
在公共架构中创建名为 myzeroifnull
的 SQL 函数:
=> CREATE FUNCTION myzeroifnull(x INT) RETURN INT
AS BEGIN
RETURN (CASE WHEN (x IS NOT NULL) THEN x ELSE 0 END);
END;
现在查询 USER_FUNCTIONS
表。查询仅返回 myzeroifnull
宏,因为它是在此架构中创建的唯一宏:
=> SELECT * FROM user_functions;
-[ RECORD 1 ]----------+---------------------------------------------------
schema_name | public
function_name | myzeroifnull
procedure_type | User Defined Function
function_return_type | Integer
function_argument_type | x Integer
function_definition | RETURN CASE WHEN (x IS NOT NULL) THEN x ELSE 0 END
volatility | immutable
is_strict | f
is_fenced | f
comment |
另请参阅
77 - USER_PROCEDURES
提供有关存储过程和外部过程的信息。用户只能看到他们可以执行的过程。
特权
非超级用户只有在拥有以下权限时才能查看过程的相关信息:
-
对过程架构的 USAGE 权限。
-
对过程的所有权或 EXECUTE 权限。
示例
=> SELECT * FROM user_procedures;
procedure_name | owner | language | security | procedure_arguments | schema_name
--------------------+---------+----------+----------+-----------------------------------------------------------------------------------+-------------
accurate_auc | dbadmin | PL/vSQL | INVOKER | relation varchar, observation_col varchar, probability_col varchar, epsilon float | public
conditionalTable | dbadmin | PL/vSQL | INVOKER | b boolean | public
update_salary | dbadmin | PL/vSQL | INVOKER | x int, y varchar | public
(3 rows)
78 - USER_TRANSFORMS
列出当前定义的用户定义转换函数 (UDTF)。
特权
不需要显式权限;但是,用户只会看到他们具有读取权限的架构中包含的 UDTF。
另请参阅
80 - VIEW_COLUMNS
提供视图属性信息。
注意
如果您删除视图引用的表,Vertica 不会删除该视图。但是,尝试从VIEW_COLUMNS
访问有关该视图的信息会返回错误,表示视图无效。
另请参阅
VIEWS
81 - VIEW_TABLES
显示视图相关依赖项(包括引用视图的表、其架构和所有者)的相关详细信息。