|
|
|
|
Browse by Tags
All Tags » SQL » Database Programming (RSS)
-
The following pattern is quite common in database
programming:
IF EXISTS(some query) BEGIN
DO SOMETHING;
END
When such code runs in high concurrency situations, it may
not work as expected. I will provide a repro when such logic fails 40% of the
time. The following script provides a test table and attempts to ...
-
If your data has a small percentage of duplicates, then IGNORE_DUP_KEY
may speed up your inserts. For larger amounts of duplicates, IGNORE_DUP_KEY may
slow them down significantly. I set up two tables, stripping down all the
irrelevant details, as follows:
CREATE TABLE t1(n INT NOT NULL PRIMARY KEY)
GO
CREATE TABLE ...
|
|
|
|
|