NilsBevaart
Programmer
I have a table with very straight forward fields. To populate this table, I have the following stored procedure:
ALTER PROCEDURE proc_AddPostBack
@PostBackID UNIQUEIDENTIFIER,
@UserID UNIQUEIDENTIFIER,
@UserIP CHAR(15),
@PBControlID VARCHAR(255),
@BillingMetadataKey CHAR(32) = NULL
AS
INSERT INTO tblPostBack (
PostBackID,
UserID,
UserIP,
PostBackControl,
PBCreateDate,
BillingMetadataKey)
VALUES (
@PostBackID,
@UserID,
@UserIP,
@PBControlID,
GETUTCDATE(),
@BillingMetadataKey)
The table has only a primary key on PostBackID (clustered) and it's statistics are up to date and the index is defragmented.
Often, this stored procedure takes minutes to run. After this, all consecutive runs are processed in 0 seconds.
How come sometimes this is so slow? I tried moving the database to a new server. There are NO other processes or databases running on the server. Our monitoring tool doesn't show any disk, memory or cpu use.
Any help is appriciated
Nils Bevaart
ALTER PROCEDURE proc_AddPostBack
@PostBackID UNIQUEIDENTIFIER,
@UserID UNIQUEIDENTIFIER,
@UserIP CHAR(15),
@PBControlID VARCHAR(255),
@BillingMetadataKey CHAR(32) = NULL
AS
INSERT INTO tblPostBack (
PostBackID,
UserID,
UserIP,
PostBackControl,
PBCreateDate,
BillingMetadataKey)
VALUES (
@PostBackID,
@UserID,
@UserIP,
@PBControlID,
GETUTCDATE(),
@BillingMetadataKey)
The table has only a primary key on PostBackID (clustered) and it's statistics are up to date and the index is defragmented.
Often, this stored procedure takes minutes to run. After this, all consecutive runs are processed in 0 seconds.
How come sometimes this is so slow? I tried moving the database to a new server. There are NO other processes or databases running on the server. Our monitoring tool doesn't show any disk, memory or cpu use.
Any help is appriciated
Nils Bevaart