Table export can be faster by generating several scripts running in parallel. Each script retrieve different chunk of data, without moving it to the initiator over the LAN. Minimum LAN traffic can be achieved when the initiator select only local tuples that it has.
In the following test script on 10 node cluster,
Why does the physical node name (node 2)
don’t match the calculated DEFAULT node_id (6 and 3)?
cat test_csv.sql
DROP TABLE testcsv CASCADE;
CREATE TABLE testcsv(
rowid int,
node_id int DEFAULT FLOOR(HASH(rowid)/((9223372036854775807/10) + 1)))
ORDER BY rowid
SEGMENTED BY HASH(rowid) ALL NODES;
-- Insert 100 rows
\set DEMO_ROWS 100
INSERT INTO testcsv
WITH myrows AS (SELECT row_number() over() as rowid
FROM ( SELECT 1 FROM ( SELECT now() AS se UNION ALL SELECT NOW() + :DEMO_ROWS - 1 AS se) a TIMESERIES ts AS '1 day' OVER (ORDER BY se)) b)
SELECT rowid FROM myrows;
COMMIT;
SELECT /* +LABEL(unique_09_43) */ rowid, node_id
from testcsv_b0 where rowid = 43 ;
select node_name from v_monitor.resource_acquisitions
where transaction_id=(SELECT transaction_id
from dc_requests_issued
where label='unique_09_43') and
statement_id = (SELECT statement_id
from dc_requests_issued
where label='unique_09_43') order by 1;
SELECT /* +LABEL(unique_09_44) */ rowid, node_id
from testcsv_b0 where rowid = 44 ;
select node_name
from v_monitor.resource_acquisitions
where transaction_id=(SELECT transaction_id
from dc_requests_issued
where label='unique_09_44') and
statement_id = (SELECT statement_id
from dc_requests_issued
where label='unique_09_44') order by 1;
vsql -Xf test_csv.sql
rowid | node_id
-------+---------
43 | 6
(1 row)
node_name
v_vdb3_node0002
(1 row)
rowid | node_id
-------+---------
44 | 3
(1 row)
node_name
v_vdb3_node0002
(1 row)
