@@ -3319,3 +3319,61 @@ above, we can do it.
3319
3319
---------------------------(end of broadcast)---------------------------
3320
3320
TIP 2: Don't 'kill -9' the postmaster
3321
3321
3322
+ From simon@2ndquadrant.com Thu Jan 5 16:56:25 2006
3323
+ Return-path: <simon@2ndquadrant.com>
3324
+ Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54])
3325
+ by candle.pha.pa.us (8.11.6/8.11.6) with ESMTP id k05LuPb02246
3326
+ for <pgman@candle.pha.pa.us>; Thu, 5 Jan 2006 16:56:25 -0500 (EST)
3327
+ Received: from [192.168.0.3] (unknown [84.12.184.6])
3328
+ by smtp.nildram.co.uk (Postfix) with ESMTP
3329
+ id A9F0F268C4E; Thu, 5 Jan 2006 21:56:18 +0000 (GMT)
3330
+ Subject: Re: [HACKERS] [Bizgres-general] WAL bypass for INSERT, UPDATE and
3331
+ From: Simon Riggs <simon@2ndquadrant.com>
3332
+ To: Bruce Momjian <pgman@candle.pha.pa.us>
3333
+ cc: Tom Lane <tgl@sss.pgh.pa.us>, Martijn van Oosterhout <kleptog@svana.org>,
3334
+ Greg Stark <gsstark@mit.edu>, Rod Taylor <pg@rbt.ca>,
3335
+ Qingqing Zhou <zhouqq@cs.toronto.edu>, pgsql-hackers@postgresql.org
3336
+ In-Reply-To: <200601051727.k05HR5p02803@candle.pha.pa.us>
3337
+ References: <200601051727.k05HR5p02803@candle.pha.pa.us>
3338
+ Content-Type: text/plain
3339
+ Date: Thu, 05 Jan 2006 21:56:21 +0000
3340
+ Message-ID: <1136498181.21025.285.camel@localhost.localdomain>
3341
+ MIME-Version: 1.0
3342
+ X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4)
3343
+ Content-Transfer-Encoding: 7bit
3344
+ Status: OR
3345
+
3346
+ On Thu, 2006-01-05 at 12:27 -0500, Bruce Momjian wrote:
3347
+
3348
+ > Seems like a nice optimization.
3349
+
3350
+ Negative thoughts: Toast tables have a toast index on them, yes? We have
3351
+ agreed that we cannot use the optimization if we have indexes on the
3352
+ main table. It follows that we cannot use the optimization if we have
3353
+ *any* toasted data, since that would require a pointer between two
3354
+ blocks, which would not be correctly recovered following a crash. If we
3355
+ log the toast table then there could be a mismatch between heap and
3356
+ toast table; if we don't log the toast table there could be a mismatch
3357
+ between toast table and toast index.
3358
+
3359
+ We can test to see if the toast table is empty when we do ALTER TABLE,
3360
+ but loading operations may try to create toasted data rows.
3361
+
3362
+ Presumably that means we must either:
3363
+ i) abort a COPY if we get a toastable value
3364
+ ii) if we get a toastable value, insert the row into a new block, which
3365
+ we do logging of, then also log the toast insert and the toast index
3366
+ insert - i.e. some blocks we log, others not
3367
+
3368
+ This is still useful for many applications, IMHO, but the list of
3369
+ restrictions seems to be growing. Worse, we wouldn't know that the toast
3370
+ tables were empty until after we did the COPY TO for a pg_dump, so we
3371
+ wouldn't be able to retrospectively add an ALTER TABLE command ahead of
3372
+ the COPY.
3373
+
3374
+ Thoughts? Hopefully there are some flaws in my thinking here,
3375
+
3376
+ Best Regards, Simon Riggs
3377
+
3378
+
3379
+
0 commit comments