有没有办法列出所有未提交的更改HP vertica? 像命令一样列出了所有未提交效果的命令。
答案 0 :(得分:2)
您可以查看表格的EPOCH列。如果为NULL,则表示数据未提交。
简单示例:
dbadmin=> create table jim (a int);
CREATE TABLE
dbadmin=> insert into jim values (1);
OUTPUT
--------
1
(1 row)
dbadmin=> select *, epoch from jim;
a | epoch
---+-------
1 |
(1 row)
dbadmin=> commit;
COMMIT
dbadmin=> select *, epoch from jim;
a | epoch
---+--------
1 | 424446
(1 row)
答案 1 :(得分:0)
根据未提交的更改,您指的是存储在 WOS 中的数据?
如果存储 WOS 数据:
从projection_storage中选择*,其中wos_used_bytes> 0; 强>
存储到WOS但未传递给ROS的所有数据都保留在内存中,因此如果您在WOS中获取数据并且群集中断,则会丢失该数据。
以下是一个小型演示,您可以放弃WOS存储的数据:
--create a table
(dbadmin@:5433) [dbadmin] > create table test(name varchar(10));
CREATE TABLE
--insert some data using default method (no direct hint)
(dbadmin@:5433) [dbadmin] > insert into test values('Adrian');
OUTPUT
--------
1
(1 row)
-- commit your data (makes no difference if data is in WOS)
(dbadmin@:5433) [dbadmin] > commit;
-- look for WOS stored data
(dbadmin@:5433) [dbadmin] *> select * from projection_storage where wos_used_bytes > 0;
-[ RECORD 1 ]-----------+------------------
node_name | v_d_node0001
projection_id | 45035996273828324
projection_name | test_super
projection_schema | public
projection_column_count | 2
row_count | 1
used_bytes | 16384
wos_row_count | 1
wos_used_bytes | 16384
ros_row_count | 0
ros_used_bytes | 0
ros_count | 0
anchor_table_name | test
anchor_table_schema | public
anchor_table_id | 45035996273828322
-- kill vertica process
(dbadmin@:5433) [dbadmin] *>\! kill -9 21582 21596 21580 5883 5866
-- try a query
(dbadmin@:5433) [dbadmin] *> select * from projection_storage where wos_used_bytes > 0;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
(@:) [] ?>
(@:) [] ?>
(@:) [] ?> \q
-- start vertica
[dbadmin@DCG023 ~]$ vsql
Password:
Welcome to vsql, the Vertica Analytic Database interactive terminal.
Type: \h or \? for help with vsql commands
\g or terminate with semicolon to execute query
\q to quit
-- see if data was commited
(dbadmin@:5433) [dbadmin] > select * from test;
name
------
(0 rows)
-- see WOS stored data
(dbadmin@:5433) [dbadmin] *> select * from projection_storage where wos_used_bytes > 0;
(No rows)
要将数据从 WOS 移至 ROS ,您可以在语句中使用/*+ DIRECT */
提示,或在语句后手动运行do_tm_tack('moveout')
(此操作在后台以预设间隔自动完成。)
如果数据保持在 WOS 更多,那么您需要查看MoveOutInterval
参数值,以了解这种情况发生的原因。
还要查看 lock 表中的任何对象锁。