Skip to Content
0

Is it recommended to use foreign keys in HANA ?

Mar 13, 2017 at 12:45 PM

80

avatar image
G B

Could anyone please let me know if it is worthy to use foreign keys to maintain data integrity at the expense of performance in SAP HANA.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Lars Breddemann
Mar 13, 2017 at 11:54 PM
2

If you are asking this question, then the answer is likely: YES!
Do implement any measure that helps your data to be consistent.

Not using DB constraints puts the responsibility for ensuring data consistency to the application layer. That means you, the developer, has to write or use code that does these things.

Are you doing that? If so, what kind of consistency do you ensure? Avoiding duplicates? Avoiding false references through insert/update/deletes? Does your data model even allow for automatic consistency handling? Approaches like entity-value-store modelling decidedly don't allow for that.

Data consistency is never the question of performance. You don't want your wrong data to be processed faster. The results will still be wrong.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 13, 2017 at 02:28 PM
1

Hi Gowthami,

Foreign Keys are called Referential Constraints in SAP HANA. Maintaining Referential Constraints for a tables to check the data integrity depends on the requirement. if we are dealing with some transaction requirement and not focusing on just creating a datawarehouse, i would suggest to go for it.

Thanks

Share
10 |10000 characters needed characters left characters exceeded