Hi Peter,
Take the picture i sent in my previous mail and here is the corresponding
table SQL description. In the validity table my actual design uses
the AUTO_INCREMENT data type (mysql).
CREATE TABLE FAIRDBLOGENTRYVAL(
SEQNO INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
TIMESTART DATETIME NOT NULL,
TIMEEND DATETIME NOT NULL,
DETID TINYINT,
DATAID TINYINT,
VERSION INT,
COMPOSITEID INT,
TIMEINCR DATETIME NOT NULL,
TIMETRANS DATETIME NOT NULL
);
CREATE TABLE FAIRDBLOGENTRY(
SEQNO INT,
ROW_ID INT,
TABLENAME TEXT,
MIN_SEQNO INT NOT NULL,
MAX_SEQNO INT NOT NULL,
N_SEQNO INT NOT NULL,
USERNAME TEXT,
PROCESS_ID TEXT,
HOSTNAME TEXT,
SERVERNAME TEXT,
LOG_TITLE TEXT
);
A typical query to search for a proper SEQNO in that data table would be something like ( another Validity table is used here STSQASENSORPARVAL);
[2015/12/02 09:30:32] -I- FairDb: FairDbProxy.cxx::QueryValidity():[300] $ db_id: 0 SQL query: select * from STSQASENSORPARVAL where TimeStart <= '2015-12-11 18:00:00' and TimeEnd > '2015-11-21 18:00:00' and DETID & 32 and DATAID & 1 and Version = 0 order by TIMEINCR desc;
[2015/12/02 09:30:32] -I- FairDb: FairDbStatement.cxx::ExecuteQuery():[72] $ Server:r3b SQL:select * from STSQASENSORPARVAL where TimeStart <= '2015-12-11 18:00:00' and TimeEnd > '2015-11-21 18:00:00' and DETID & 32 and DATAID & 1 and Version = 0 order by TIMEINCR desc;
Of course other select statements are used in combination with these above to find the corresponding SEQNO for a particular validity interval definition.
With the SEQNO number one can than fetch all rows from the corresponding data table. The concept works fine in any standard SQL database.
My question is what happens if the two tables xxDATA and xxVAL are now define in cockroach ? When i query on the VAL table i get a SEQNO, with this SEQNO i
need to fetch the rows in a second table ( kind of handmade JOIN if you want ) . To be consistent in the procedure may the application itself
has to then define a global SEQNO ?
Cheers,
Denis