vetica的系统库v_catalog 和v_monitor

HP Vertica提供了可让您监控数据库的系统表。 通过使用SELECT语句,以与在基表或临时表上执行查询操作相同的方式查询这些表。

v_catalog模式中:提供关于数据库中的对象的信息(元数据) 例如表格,约束,用户,投影等等。

v_monitor模式中:提供有关HP Vertica数据库运行状况的信息。

v_catalog中的表记录的是整个vertica集群、节点、数据库、模式、表、资源池、列、用户、权限及相关设置的元数据信息,是对vertica这个集群所有信息的概述。

v_monitor中的表记录的是整个vertica数据库中操作数据的逻辑轨迹及其实时运行状态,其包含了会话(session)、事务(truncation)、查询(query)等维度,


1、all_tables


2、CLUSTER_LAYOUT
显示参与集群的节点的实际排列和影响它们的故障组的相对位置。 临时节点不显示在集群布局环中,因为它们不包含驻留数据。

3、columns


4、system_tables 和databases和tables

总共162个系统表,且有注释可以看每个表的大致作用:



5、dual

6、ELASTIC_CLUSTER

显示每个集群节点的使用情况:

7、\dp和\z:查看数据库和表的授权



8、licenses


9、nodes


10、passwords


10、profiles

11、resource_pool_defaults 和resource_pools(资源池设置和资源池)

二、v_monitor

1、active_events


2、lock_usage

NODE_NAME

VARCHAR

Name of the node that is reporting the requested information on which lock interaction occurs.

SESSION_ID

VARCHAR

Identifier for this session. This identifier is unique within the cluster at any point in time but can be reused when the session closes.

OBJECT_NAME

VARCHAR

Name of object being locked; can be a table or an internal structure (projection, global catalog, or local catalog).

MODE

VARCHAR

Intended operations of the transaction:

  • S — Share lock needed for select operations.
  • I — Insert lock needed for insert operations.
  • SI — Share+Insert lock needed for operations that read and query the table. Distinguished from X because SI mode disallows delete/update operations. SI is also the result of lock promotion (see Table 2).
  • X — Exclusive lock is always needed for delete operations. X lock is also the result of lock promotion (see Table 2).
  • T — Tuple Mover lock used by the Tuple Mover and also used for COPY into pre-join projections.
  • U — Usage lock needed for moveout and mergeout operations in the first phase; they then upgrade their U lock to a T lock for the second phase. U locks conflicts with no other locks but O.
  • O — Owner lock needed for DROP_PARTITION, TRUNCATE TABLE, and ADD COLUMN. O locks conflict with all locks. O locks never promote.
  • NONE

S - 选择操作所需的共享锁。
I - 插入操作所需的插入锁定。
SI - 共享+读取和查询表的操作所需的插入锁。 区别于X,因为SI模式不允许删除/更新操作。 SI也是锁升级的结果(见表2)。
X - 独占锁定总是需要删除操作。 X锁也是锁升级的结果(见表2)。
Tuple Mover使用的T - Tuple Mover锁,也用于COPY预连接投影。
U - 第一阶段时差和合并操作所需的使用锁定; 然后他们将U锁升级为第二阶段的T锁。 U锁不和其他锁冲突,除了O.
O - DROP_PARTITION,TRUNCATE TABLE和ADD COLUMN所需的所有者锁定。 O锁与所有锁冲突。 O锁永远不会升级。
没有

共享(S)锁:多个事务可封锁一个共享页;任何事务都不能修改该页; 通常是该页被读取完毕,S锁立即被释放。 
排它(X)锁:仅允许一个事务封锁此页;其他任何事务必须等到X锁被释放才能对该页进行访问;X锁一直到事务结束才能被释放。 
更新(U)锁:用来预定要对此页施加X锁,它允许其他事务读,但不允许再施加U锁或X锁;当被读取的页将要被更新时,则升级为X锁;U锁一直到事务结束时才能被释放。

AVG_HOLD_TIME

INTERVAL

Average time (measured in intervals) that HP Vertica holds a lock.

MAX_HOLD_TIME

INTERVAL

Maximum time (measured in intervals) that HP Vertica holds a lock.

HOLD_COUNT

INTEGER

Total number of times lock was taken in the given mode.

AVG_WAIT_TIME

INTERVAL

Average time (measured in intervals) that HP Vertica waits on the lock

MAX_WAIT_TIME

INTERVAL

Maximum time (measured in intervals) that HP Vertica waits on a lock

WAIT_COUNT

INTEGER

Total number of times lock was unavailable at the time it was first requested.


3、sessions

确定正在运行长查询的用户
识别由于空闲但未提交的事务而持有锁定的用户
断开用户以关闭数据库
确定用于特定会话的数据库安全类型(安全套接字层(SSL)或客户端身份验证)的详细信息

    sessions可以查找现在还没有断开的连接,及其该连接所做的哪些操作,sessions表中的session_id表征了一个未断开的连接,根据sessions_id在query_request和query_profiles表中查看这个session_id做了哪些操作。

4、locks

 监视整个集群的锁状态,事务的锁机制及其各种形态,在前一篇有介绍,当I锁存在时候,对表进行delete操作会使得表的锁升级为X锁,X锁需要等待前面的锁释放才能消除。

 通过查看locks表中的被锁的表对应的transaction_id,再对应到sessions表中的session_id,可以看见这个session都干了什么,并且通过session_id对应到query_profiles表中的操作,可以看到这个人干了什么。

5、query_profiles和query_requests

 两者很相似,没啥大差别,后者可以看占用的内存信息



猜你喜欢

转载自blog.csdn.net/yezonggang/article/details/79232815