MySQL Forums
Forum List  »  Triggers

Pre-DML trigger vs Foreign keys
Posted by: Anushka Dissanayake
Date: June 22, 2012 10:16AM

Hi,
I have a query with regard to the usage of pre-dml triggers instead of foreign keys.
We have several tables with below scenario

As an example I will take 2 tables.


payments ( pid , userid , updated_user )
users (userid , username )

foreign keys
payment .userid -> users.userid
payment. updated_user -> user.userid

In this situation the payment table refers to user table for 2 foreign keys.

My senior DBA suggesting use before-insert trigger instead of 2 foreign keys.

Can any one explain me the performance difference between those 2 and what is the most suitable method.

Please direct me the relevent documents ,if you have any.
Thanking you in advance.

AD

Options: ReplyQuote


Subject
Views
Written By
Posted
Pre-DML trigger vs Foreign keys
2623
June 22, 2012 10:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.