X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 140B25292E for ; Sun, 12 Jun 2005 07:39:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31805-09 for ; Sun, 12 Jun 2005 10:39:32 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by svr1.postgresql.org (Postfix) with ESMTP id 5DF54528AE for ; Sun, 12 Jun 2005 07:39:31 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so812243wri for ; Sun, 12 Jun 2005 03:39:34 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=aKV9IkeSOCo041sKKkWc56u+409FzOeQck3XNpQwugOB20pE+SlOvZ83I//SHUxoVzCDR+8S3vXzgrZdzYvnaZTy8O5qD6fXiypJkgNFMMrS0vfAf0oFA6ZYHdHTG2A6cWPTxEjlX6nvF3q1yprFkrr1lHUJDkWZ41LlEtOeIHQ= Received: by 10.54.110.12 with SMTP id i12mr1333960wrc; Sun, 12 Jun 2005 03:39:34 -0700 (PDT) Received: by 10.54.5.69 with HTTP; Sun, 12 Jun 2005 03:39:34 -0700 (PDT) Message-ID: <71038fca05061203395e5a2613@mail.gmail.com> Date: Sun, 12 Jun 2005 18:39:34 +0800 From: Daniel Roth Reply-To: Daniel Roth To: pgsql-sql@postgresql.org Subject: predicate locking Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/154 X-Sequence-Number: 21755 Hi Tom Lane and the postgres help state, "AFAIK, no commercial database does predicate locking either" (12.2.2.1. Serializable Isolation versus True Serializability) But MSSQL (SQL Server) does predicate locking. From MSDN "SERIALIZABLE Places a range lock on the data set, preventing other users from updating or inserting rows into the data set until the transaction is complete. This is the most restrictive of the four isolation levels. Because concurrency is lower, use this option only when necessary. This option has the same effect as setting HOLDLOCK on all tables in all SELECT statements in a transaction " So does MSSQL (SQL Server) implement predicate locking? Regards, Daniel Roth MCSD.NET Tom Lane wrote: > Florian Weimer writes: > > Is this a bug, or is SQLxx serializability defined in different terms? >=20 > Strictly speaking, we do not guarantee serializability because we do not > do predicate locking. See for example > http://archives.postgresql.org/pgsql-general/2003-01/msg01581.php >=20 > AFAIK, no commercial database does predicate locking either, so we all > fall short of true serializability. The usual solution if you need the > sort of behavior you're talking about is to take a non-sharable write > lock on the table you want to modify, so that only one transaction can > do the COUNT/INSERT at a time. >=20 > =09=09=09regards, tom lane >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if you= r > joining column's datatypes do not match