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;

1 Comments:

Anonymous Adam Burch said...

Hi greeat reading your blog

12:12 AM

 

Post a Comment

<< Home