On 17.04.2012 02:54, Michael Nolan wrote:
On Mon, Apr 16, 2012 at 6:27 PM, Thom Brown<t...@linux.com>  wrote:

Hi,

I've noticed that when using synchronous replication (on 9.2devel at
least), temporary tables become really slow:

Since temporary tables are only present until the session ends (or
possibly only until a commit), why are they replicated at all?

They're not replicated.

What happens is that we write the commit record if the transaction accesses a temporary table, but we don't flush it. However, we still wait until it's replicated to the standby. The obvious fix is to not wait for that, see attached.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e22bdac..d8523f3 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1168,7 +1168,8 @@ RecordTransactionCommit(void)
 	 * Note that at this stage we have marked clog, but still show as running
 	 * in the procarray and continue to hold locks.
 	 */
-	SyncRepWaitForLSN(XactLastRecEnd);
+	if (wrote_xlog)
+		SyncRepWaitForLSN(XactLastRecEnd);
 
 	/* Reset XactLastRecEnd until the next transaction writes something */
 	XactLastRecEnd.xrecoff = 0;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to