我有一个3节点的集群。有1个数据库和1个表。我没有创建投影。如果我使用复制命令在表中加载100行,则:
- 将创建多少个投影?我怀疑只有一个超级投影,对吗
- 如果我使用的是
segmentation
,那么每个节点的数据分布是否均匀(约33行(?这是否意味着我现在每个节点有3个读取Optimised Storage (ROS)
,而投影有3个ROS
- 如果我使用
KSafety
值作为1,那么每个ROS
(好友(的副本将存储在另一个节点中?那么我现在有6个ROS
,每个包含33行吗
好吧,让我们播放这个场景。。。你会看到你得到一个投影和它相同的伙伴投影。。。你可以查询目录来计算行数和识别投影。。
-- load a file with 100 random generated rows into table example;
-- generate the rows from within Vertica, and export to file
-- then create a new table and see what the projections look like
CREATE TABLE rows100 AS
SELECT
(ARRAY['Ann','Lucy','Mary','Bob','Matt'])[RANDOMINT(5)] AS fname,
(ARRAY['Lee','Ross','Smith','Davis'])[RANDOMINT(4)] AS lname,
'2001-01-01'::DATE + RANDOMINT(365*10) AS hdate,
(10000 + RANDOM()*9000)::NUMERIC(7,2) AS salary
FROM (
SELECT tm FROM (
SELECT now() + INTERVAL ' 1 second' AS t UNION ALL
SELECT now() + INTERVAL '100 seconds' AS t -- Creates 100 rows
) x TIMESERIES tm AS '1 second' OVER(ORDER BY t)
) y
;
-- set field separator to vertical bar (the default, actually...)
pset fieldsep '|'
-- toggle to tuples only .. no column names and no row count
tuples_only
-- spool to example.bsv - in bar-separated-value format
o example.bsv
SELECT * FROM rows100;
-- spool to file off - closes output file
o
-- create a table without bothering with projections matching the test data
DROP TABLE IF EXISTS example;
CREATE TABLE example LIKE rows100;
-- load the new table ...
COPY example FROM LOCAL 'example.bsv';
-- check the nodes ..
SELECT node_name FROM nodes;
-- out node_name
-- out ----------------
-- out v_sbx_node0001
-- out v_sbx_node0002
-- out v_sbx_node0003
SELECT
node_name
, projection_schema
, anchor_table_name
, projection_name
, row_count
FROM v_monitor.projection_storage
WHERE anchor_table_name='example'
ORDER BY projection_name, node_name
;
-- out node_name | projection_schema | anchor_table_name | projection_name | row_count
-- out ----------------+-------------------+-------------------+-----------------+-----------
-- out v_sbx_node0001 | public | example | example_b0 | 38
-- out v_sbx_node0002 | public | example | example_b0 | 32
-- out v_sbx_node0003 | public | example | example_b0 | 30
-- out v_sbx_node0001 | public | example | example_b1 | 30
-- out v_sbx_node0002 | public | example | example_b1 | 38
-- out v_sbx_node0003 | public | example | example_b1 | 32