Forum: VoltDB Architecture

Post: Does VoltDB 'combine' the result in this way?

Does VoltDB 'combine' the result in this way?
guotong1988
Aug 14, 2015
If I start two hosts (A and B) with the schema :
CREATE TABLE TESTTABLE0 (ID INTEGER NOT NULL PRIMARY KEY,NAME0 VARCHAR(100)) ;PARTITION TABLE TESTTABLE0 ON COLUMN ID;

Then I insert data:
INSERT INTO TESTTABLE0 VALUES(1,'AAAAA');
INSERT INTO TESTTABLE0 VALUES(2,'AAAAA');
INSERT INTO TESTTABLE0 VALUES(3,'AAAAA');
INSERT INTO TESTTABLE0 VALUES(4,'AAAAA');
INSERT INTO TESTTABLE0 VALUES(5,'AAAAA');
INSERT INTO TESTTABLE0 VALUES(6,'AAAAA');

I assume that 1 3 5 are partitioned into host A and 2 4 6 are partitioned into host B

Then I query SELECT * FROM TESTTABLE0 ORDER BY ID;

I think it should sort the data in each host (A and B).

And then it should transfer the data index from B to A to show the whole data ? (If I connect to the host A by sqlcmd)
jhugg
Aug 14, 2015
The partitioning isn't always that perfect. VoltDB uses consistent hashing to distribute tuples, which allows us to elastically add nodes. But yes, roughly half your data will be on one node and half on the other.

And yes, any query sent to VoltDB from SQLCmd, from JDBC or from calling the @AdHoc procedure directly will query the whole system and combine results. You don't have to do any additional work.

From within a stored procedure, this will happen in a multi-partition procedure. In a single-partition procedure, you will only see results from the targeted partition.
rofr
Sep 21, 2015
Where does the global ordering happen for a multi-partition query? Is there a coordinator or does it happen at the client?
bballard
Sep 21, 2015
There is a multi-partition initiator (MPI) that does the global ordering. It has a thread for coordinating write transactions, and a pool of threads for coordinating read transactions, sending query instructions and receiving intermediate results from the partitions.