Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6D008B5DCDF for ; Wed, 13 Jul 2011 19:21:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 04212-02 for ; Wed, 13 Jul 2011 22:21:18 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D1057B5DCE3 for ; Wed, 13 Jul 2011 19:21:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p6DMLHWX011680; Wed, 13 Jul 2011 18:21:17 -0400 (EDT) To: "Kevin Grittner" cc: "Ivan Voras" , pgsql-performance@postgresql.org, "lars" Subject: Re: UPDATEDs slowing SELECTs in a fully cached database In-reply-to: <4E1DCE81020000250003F2DC@gw.wicourts.gov> References: <4E16479D.3050605@yahoo.com> <4E1A0CBC.6090009@yahoo.com> <4E1A31AB.9010201@postnewspapers.com.au> <1310359653.80687.YahooMailRC@web121705.mail.ne1.yahoo.com> <4E1AEDAB020000250003F1C3@gw.wicourts.gov> <4E1B41EA.90104@yahoo.com> <4E1B05CC020000250003F1E6@gw.wicourts.gov> <4E1B810D.4070404@yahoo.com> <4E1B90AF.1020408@yahoo.com> <4E1C9A05.7060005@yahoo.com> <4E1C5563020000250003F252@gw.wicourts.gov> <4E1CA8E9.6090108@yahoo.com> <4E1CB56E.7080801@yahoo.com> <4E1D697C020000250003F29A@gw.wicourts.gov><4E1D697C020000250003F29A@gw.wicourts.gov> <4752.1310570261@sss.pgh.pa.us> <4E1DCE81020000250003F2DC@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Wed, 13 Jul 2011 16:57:37 -0500" Date: Wed, 13 Jul 2011 18:21:17 -0400 Message-ID: <11679.1310595677@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/142 X-Sequence-Number: 44354 "Kevin Grittner" writes: > Tom Lane wrote: >> Huh? If there was never an XID, there's no commit WAL record, >> hence nothing to make asynchronous. > If you look at the RecordTransactionCommit() function in xact.c > you'll see that's not correct. Oh, hmmm ... that code was written with the idea that things like sequence XLOG_SEQ_LOG records ought to be flushed to disk before reporting commit; otherwise you don't have a guarantee that the same sequence value couldn't be handed out again after crash/restart, in a transaction that just does something like SELECT nextval('myseq'); without any updates of regular tables. It seems like we ought to distinguish heap cleanup activities from user-visible semantics (IOW, users shouldn't care if a HOT cleanup has to be done over after restart, so if the transaction only wrote such records there's no need to flush). This'd require more process-global state than we keep now, I'm afraid. Another approach we could take (also nontrivial) is to prevent select-only queries from doing HOT cleanups. You said upthread that there were alleged performance benefits from aggressive cleanup, but IMO that can charitably be described as unproven. The real reason it happens is that we didn't see a simple way for page fetches to know soon enough whether a tuple update would be likely to happen later, so they just do cleanups unconditionally. regards, tom lane