How well does Teradata deal with Foreign Keys? -
i'm starting new project , 1 of requirements use teradata. i'm proficient in many different database systems teradata new me.
on client end have removed foreign keys database under recommendations of "a consultant".
every part of me cringes.
i'm using new database instance i'm not constrained they've done on other databases. haven't been explicitly told not use foreign keys , relation customer such @ least hear me out. however, decision , case should well-informed.
is there intrinsic, technological reason should not use fks in teradata maintain referential integrity based upon teradata's design, performance, side-effects, etc...
of note, i'm accessing teradata using .net data provider v16 supports ef5.
assuming new project implementing data warehouse there's simple reason (and true dwh, not teradata): dwh not same oltp system.
of course still got primary & foreign keys in logical data model, maybe not implemented in physical model (although supported teradata). there several reasons:
- data loaded in batches dwh , both pk & fks must validated loading process before insert/update/delete. otherwise load 1,000,000 rows , there's single row failing constraints. got rollback , error message , try find bad data, luck. when validation done during load there's no reason same checks 2nd time within database.
- some tables in dwh changing dimensions , there's no way define pk/fk on usibg standard sql syntay, need tablea.column references tableb.column , tablea.timestamp between tableb.validfrom , tableb.validto (it possible when create temporal table)
- sometimes table recreated or reloaded scratch, hard if there's fk referencing it.
- some pks never used access/join, why implementing them physically, it's huge overhead in cpu/io/storage.
knowledge pk/fk important optimizer, there's so-called soft foreign key (references no check option), kind of dummy: applied during optimization, never checked dbms (it's telling optimizer trust me, it's correct).
Comments
Post a Comment