列出 HP vertica 中所有未提交的更改
List all uncommited changes in HP vertica
有没有办法列出所有未提交的更改 HP vertica?
类似命令的东西,它列出了所有未提交其效果的命令。
未提交的更改是指存储在 WOS 中的数据?
WOS数据存储在:
select * 来自 projection_storage 其中 wos_used_bytes > 0;
所有存储到 WOS 而未传递到 ROS 的数据都保留在内存中,因此如果您在 WOS 中遇到数据问题并且集群出现故障,您将丢失该数据。
这里有一个小demo,你可以松散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
参数值,您需要了解为什么会发生这种情况。
也看看你locks table 是否有对象锁。
您可以检查 table 的 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)
有没有办法列出所有未提交的更改 HP vertica? 类似命令的东西,它列出了所有未提交其效果的命令。
未提交的更改是指存储在 WOS 中的数据?
WOS数据存储在:
select * 来自 projection_storage 其中 wos_used_bytes > 0;
所有存储到 WOS 而未传递到 ROS 的数据都保留在内存中,因此如果您在 WOS 中遇到数据问题并且集群出现故障,您将丢失该数据。
这里有一个小demo,你可以松散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
参数值,您需要了解为什么会发生这种情况。
也看看你locks table 是否有对象锁。
您可以检查 table 的 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)