Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Bypass Referential Integrity

Author  Topic 

mrpeepers
Starting Member

9 Posts

Posted - 2005-08-26 : 14:33:10
Is there a way to bypass referential integrity for a given transaction?

I've got a database table that has 30+ foreign key constraints and on an insert we've got to run a Trigger that updates one field on the record that was just inserted (don't ask).

The update has to check the foreign keys and therefore the 97% of the cost of this transaction (about 25 average seconds) is taken by these checks.

It would be nice if there's a way to bypass referential integrity on the fly when I know integrity isn't going to be compromised.

Thanks in advance for you responses...

M

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-26 : 14:42:30
There is no way to do this without disabling them for everyone else.

Tara
Go to Top of Page

mrpeepers
Starting Member

9 Posts

Posted - 2005-08-26 : 14:46:26
Are there any options? Any alternatives? I wish I could show you the execution plan this insert and update makes. It's amazing.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-26 : 14:48:46
Why bother doing the check? Just let it bomb when it violates RI. The application should be able to handle this.

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-08-26 : 15:13:05
25 seconds....in an OTLP application?

How long do you plan to stay in business?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-26 : 15:26:01
quote:
Originally posted by X002548

25 seconds....in an OTLP application?

How long do you plan to stay in business?




That's his point though. 97% of that is spent on the RI checks.

Tara
Go to Top of Page
   

- Advertisement -