Re: Document atthasmissing default optimization avoids verification table scan

From: James Coleman <jtc331(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Document atthasmissing default optimization avoids verification table scan
Date: 2022-01-22 00:14:36
Message-ID: CAAaqYe-t0Xns=QMsoDWJWnX0g1Wv07ESL5i1u0-91xS9snXbvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 21, 2022 at 5:38 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > You've removed the "constraint verification scan" portion of this.
>
> Indeed, because that's got nothing to do with adding a new column
> (per se; adding a constraint along with the column is a different
> can of worms).

Yeah. Initially I'd thought I'd wanted it there, but by explicitly
linking people to the ALTER TABLE docs for more details (I've made
that a link now too) I'm now inclined to agree that tightly focusing
the tip is better form.

> > Re-reading this, the recommendation:
>
> > - However, if the default value is volatile (e.g.,
> > - <function>clock_timestamp()</function>)
> > - each row will need to be updated with the value calculated at the time
> > - <command>ALTER TABLE</command> is executed. To avoid a potentially
> > - lengthy update operation, particularly if you intend to fill the
> > column
> > - with mostly nondefault values anyway, it may be preferable to add the
> > - column with no default, insert the correct values using
> > - <command>UPDATE</command>, and then add any desired default as
> > described
> > - below.
>
> > has now been completely removed from the documentation.
>
> Really? That's horrid, because that's directly useful advice.

Remedied, but rewritten a bit to better fit with the new style/goal of
that tip).

Version 3 is attached.

James Coleman

Attachment Content-Type Size
v3-0001-Document-atthasmissing-default-avoids-verificatio.patch text/x-patch 1.5 KB
v3-0002-Don-t-double-document-ADD-COLUMN-optimization-det.patch text/x-patch 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vrund shah 2022-01-22 02:42:07 Re: How to get started with contribution
Previous Message Bossart, Nathan 2022-01-21 23:32:57 Re: do only critical work during single-user vacuum?