Wednesday, April 19, 2006

table-level locking

MS SQL:
SET @m_Hit = (SELECT hit FROM totalhits WITH (TABLOCKX))
SET @m_Hit = @m_Hit + 1


PostgreSQL:

method 1:
SELECT hit INTO m_Hit FROM totalhits FOR UPDATE;
m_Hit = m_Hit + 1;

method 2:
LOCK TABLE pagehit IN SHARE ROW EXCLUSIVE MODE;
SELECT hit INTO m_Hit FROM totalhits;
m_Hit = m_Hit + 1;

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home