Hi All, +1 Stat table should hold only "facts". They should bot have any referential integrity at all, since stat records will not get any updates at all.
Cheers, Ruwan On Thu, Mar 3, 2016 at 6:37 AM, Lahiru Cooray <[email protected]> wrote: > Hi, > I suggest that we should *not* enforce any referential integrity to Stats > related tables. > > eg: > CREATE TABLE IF NOT EXISTS APM_APP_HITS ( > UUID VARCHAR(500) NOT NULL, > APP_NAME VARCHAR(200) NOT NULL, > VERSION VARCHAR(50), > CONTEXT VARCHAR(256) NOT NULL, > USER_ID VARCHAR(50) NOT NULL, > TENANT_ID INTEGER, > HIT_TIME TIMESTAMP NOT NULL, > PRIMARY KEY (UUID, USER_ID, TENANT_ID, HIT_TIME), > FOREIGN KEY (UUID) REFERENCES APM_APP(UUID) ON UPDATE CASCADE ON DELETE > CASCADE > ); > > For an example this is a table we use to store stats related information > (user App access details). And we have added a foreign key constraint to > UUID (with cascade on delete) > If the original entry get deleted from the APM_APP, it will also delete > the references from this table as well. So we will loose some required > information. > > So I suggest we should maintain the stat tables in a flat structure > without any reference to external tables, so need to remove the foreign key > constraints. > WDYT? > > -- > *Lahiru Cooray* > Software Engineer > WSO2, Inc.;http://wso2.com/ > lean.enterprise.middleware > > Mobile: +94 715 654154 > -- *Ruwan Abeykoon* *Architect,* *WSO2, Inc. http://wso2.com <http://wso2.com/> * *lean.enterprise.middleware.* email: [email protected]
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
