If there is high contention to write to a single page especially since it
has an identity column and everything wants to be written to the same page
in one go, would that lead to latch waits and if so, how can we circumvent ?
Right now, we have a flurry of application servers that want to write to
this one particular table and at times its very heavy contention..
Does SQL server lets multiple apps to write to the same page for the same
table at the same time ? I thought locks would prevent it from happening..no
?If that's the problem, the obvious question is, can you avoid or reduce
writing to the same page?
Linchi
"Hassan" wrote:
> If there is high contention to write to a single page especially since it
> has an identity column and everything wants to be written to the same page
> in one go, would that lead to latch waits and if so, how can we circumvent ?
> Right now, we have a flurry of application servers that want to write to
> this one particular table and at times its very heavy contention..
> Does SQL server lets multiple apps to write to the same page for the same
> table at the same time ? I thought locks would prevent it from happening..no
> ?
>
>
Showing posts with label identity. Show all posts
Showing posts with label identity. Show all posts
Wednesday, March 21, 2012
Wednesday, March 7, 2012
Hierarchical table (count)
Hello
for MS SQL 2000 i am having :
CREATE TABLE [dbo].[Items](
[id_Items] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,
[id_ItemsSup] [int] NULL,
[Name] [nvarchar] (100) NOT NULL,
[SubItems][int] DEFAULT (0)
) ON [PRIMARY]
with :
UPDATE [Items] SET SubItems = (SELECT COUNT(id_Items) AS ct FROM dbo.Items WHERE id_ItemsSup = 1) WHERE id_Items = 1
I get how many subItems has Item = 1
how can I update the Column SubItems (for each row) ?
to get the total of subItems for each Item ?
thank youupdate Items set subitems = (select count(*) from items where Id_ItemsSup = A.Id_ItemsSup) from Items A|||it works fine
thank you
for MS SQL 2000 i am having :
CREATE TABLE [dbo].[Items](
[id_Items] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,
[id_ItemsSup] [int] NULL,
[Name] [nvarchar] (100) NOT NULL,
[SubItems][int] DEFAULT (0)
) ON [PRIMARY]
with :
UPDATE [Items] SET SubItems = (SELECT COUNT(id_Items) AS ct FROM dbo.Items WHERE id_ItemsSup = 1) WHERE id_Items = 1
I get how many subItems has Item = 1
how can I update the Column SubItems (for each row) ?
to get the total of subItems for each Item ?
thank youupdate Items set subitems = (select count(*) from items where Id_ItemsSup = A.Id_ItemsSup) from Items A|||it works fine
thank you
Subscribe to:
Posts (Atom)