如果我在 3 节点集群中加载 100 行的 table,将创建多少个 ROS 容器

How many ROS containers would be created if I am loading a table with 100 rows in a 3 node cluster

我有一个 3 节点集群。有1个数据库和1个table。我没有创建投影。如果我使用复制命令在 table 中加载 100 行,则:

  1. 将创建多少投影?我怀疑只有 1 个超级投影,我猜对了吗?
  2. 如果我使用 segmentation 那么每个节点会均匀分布数据(约 33 行)吗?这是否意味着我现在每个节点有 3 个 Read Optimised Storage (ROS) 并且投影有 3 个 ROSes?
  3. 如果我使用 KSafety 值作为 1 那么每个 ROS(伙伴)的副本将存储在另一个节点中?那么我现在是否有 6 个 ROSes,每个包含 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