about foreign key
I have impression that foreign key definition helps Vertica optimizer. In the scenario that I have a slowly changing dimension and fact table has the dimension key without version, create table product_dim ( product_key int, version int, date_from date, date_to date, price decimal(6,2), primary key (product_key, version) ) create table sales_fact ( date_key int, product_key int, sales_amount decimal(8,2) ) alter table sales_fact add constraint fk_product foreign key (product_key) references product_dim (product_key); If I define foreign key like above, I got error "ROLLBACK 4550: Referenced primary key constraint does not exist" since version is part of primary key but not foreign key. How can I address this or just forget about foreign key? How much benefit foreign key can help with the query performance? Thanks
0
Comments