X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 8AD3C3102A5 for ; Fri, 27 Jun 2003 21:31:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 42959-01 for ; Fri, 27 Jun 2003 18:31:30 -0300 (ADT) Received: from web11106.mail.yahoo.com (web11106.mail.yahoo.com [216.136.131.153]) by svr1.postgresql.org (Postfix) with SMTP id 4127D310288 for ; Fri, 27 Jun 2003 18:31:30 -0300 (ADT) Message-ID: <20030627213130.17702.qmail@web11106.mail.yahoo.com> Received: from [208.10.65.130] by web11106.mail.yahoo.com via HTTP; Fri, 27 Jun 2003 14:31:30 PDT Date: Fri, 27 Jun 2003 14:31:30 -0700 (PDT) From: Michael Kovalcik Subject: Re: How do I select the last Id in a column??? To: Josh Goldberg , Bruno Wolff III Cc: Michael Kovalcik , pgsql-admin@postgresql.org In-Reply-To: <02a101c33cce$7af916a0$6e02a8c0@4dmatrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200306/329 X-Sequence-Number: 9320 All, i got the answer i was needing. I used the following: select max(id) from table it works great!! :) --- Josh Goldberg wrote: > What could cause a table to act serialized when read > committed transactions > are set in the configuration? That is something I > am running into, which > provoked my [incorrect] example. > > From: "Bruno Wolff III" > Sent: Thursday, June 26, 2003 4:30 PM > > On Thu, Jun 26, 2003 at 14:00:33 -0700, > > Josh Goldberg wrote: > > > to get the last record inserted just > > > select * from row order by autoincId desc limit > 1; > > > > > > if you have several clients doing this you might > want to put your insert > and > > > the select inside a transaction. > > > > That won't help. Your suggestion will only work in > serializable > transactions. > > > > In read committed mode the select might see a > value for autoincId from > > a transaction that committed between the insert > and the select. > > > > ---------------------------(end of > broadcast)--------------------------- > > TIP 8: explain analyze is your friend > > > __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com