Link to home
Start Free TrialLog in
Avatar of Mr_Shaw
Mr_Shaw

asked on

I am trying to delete a record.

I am trying to delete a record.

The transaction is hanging.

I have check and no blocking appears to be happening.

Can anybody help
ASKER CERTIFIED SOLUTION
Avatar of Kobe_Lenjou
Kobe_Lenjou
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mr_Shaw
Mr_Shaw

ASKER

I am not able to post to exact schema... but here is a pseudo schema.. there are also too many indexes to post.

CREATE TABLE [dbo].[test1](
      [ID] [int] IDENTITY(17235698,1) NOT FOR REPLICATION NOT NULL,
      [Text] [nvarchar](200) NULL,
      Area INT
      
 CONSTRAINT [PK_test1] PRIMARY KEY CLUSTERED
(
      [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [FG_Standard]
) ON [FG_Standard]

GO

ALTER TABLE [dbo].[test1]  WITH CHECK ADD  CONSTRAINT [FK_test1_Area] FOREIGN KEY([Area])
REFERENCES [dbo].[Area] ([ID])
GO

Have you checked the estimated query plan of the delete statement for any anomalies?
Avatar of Mr_Shaw

ASKER

Hi Kobe_Lenjou:,

there is no wait state:

I am using spotlight and nothing is showing up as blocking or locking,
Avatar of Mr_Shaw

ASKER

Hi Kobe_Lenjou,

I just checked estimated query plan and there are about 20 index scans.

I am not sure what to look for with regards to delete statement anomalies.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
what is the "delete" statement?
can you show the estimated explain plan?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mr_Shaw

ASKER

Hi angelIII,

the delete is a standar:

delete from table1
where ID =123.

I can estimate the plan......It seems massive.. with loads of index scan.
Avatar of Mr_Shaw

ASKER

Hi Kobe_Lenjou,

Which part of the plan should I look at?

The final delete operator cost is 0..176462.

I just ran it again I finally deleted one record after 39 seconds.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mr_Shaw

ASKER

yes there are foreign keys to the table.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mr_Shaw

ASKER

thanks
Avatar of Mr_Shaw

ASKER

I just added indexes on the largest tables with foreign keys to the table which I am deleting from.

I took it down to 0 seconds for a delete.

I justed to tool SQL Sentry Plan to analyses the execution plan.