pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Huge tables, trying to delete OID's taking 6+hours per table
Date: Tue, 19 May 2020 12:06:38 -0500
Message-ID: <0c0d572a-95ad-42ec-6977-8cd744ad0065@gmail.com> (raw)
In-Reply-To: <CAEaSS0YNA4XL5JkFB2H8_+FZ2LcEyCFAkRgUkoW6s6Ubxbmt3Q@mail.gmail.com>
References: <CAEaSS0YMuvA_J8LOLWwxFaxVAFhgezekB3vQycywQdiiDud2Hg@mail.gmail.com>
	<CAEaSS0Yzm0F9w+tWPOX5OHWRq44-s1Tn0kKsEV0hjniYeWDC_A@mail.gmail.com>
	<27067.1589895643@sss.pgh.pa.us>
	<CAEaSS0YNA4XL5JkFB2H8_+FZ2LcEyCFAkRgUkoW6s6Ubxbmt3Q@mail.gmail.com>

On 5/19/20 11:51 AM, Tory M Blue wrote:
>
>
> On Tue, May 19, 2020 at 6:40 AM Tom Lane <tgl@sss.pgh.pa.us 
> <mailto:tgl@sss.pgh.pa.us>> wrote:
>
>     Tory M Blue <tmblue@gmail.com <mailto:tmblue@gmail.com>> writes:
>     > The command i'm using is
>     > ALTER TABLE tablename SET WITHOUT OIDS;
>     > Would a drop column oid be better?
>
>     Unfortunately, you're kind of stuck.  OIDs are not like regular columns
>     (at least before v12) --- they are integrated into the tuple header in
>     a hackish way, and so there's no way to get rid of them without a table
>     rewrite.
>
>                             regards, tom lane
>
>
> Poop :) kind of figured that, so it's just painful.
>
> But  I guess if it's doing a table rewrite, is there any configuration 
> params I could boost to help it? Shared_buffers, give it more, work mem, 
> maintenance mem, temp buffers anything you can think of?

There's an alternative if this is a "transaction table" (named, in this 
example, FOO) which never gets updated (only inserted into and selected from).

Create a new, partitioned, oid-free copy of the table (named NEW_FOO) that's 
populated with *most* of the records (all except the most recent).  When 
ready to cut over, you'd stop the applications, copy over the most current 
records from FOO to NEW_FOO and then rename FOO to OLD_FOO and FOO to OLD_FOO.

Then you can drop OLD_FOO.

-- 
Angular momentum makes the world go 'round.

view thread (7+ messages)  latest in thread

Message-ID: <0c0d572a-95ad-42ec-6977-8cd744ad0065@gmail.com>
Permalink:  ../0c0d572a-95ad-42ec-6977-8cd744ad0065@gmail.com/
Also on:    postgresql.org/message-id/0c0d572a-95ad-42ec-6977-8cd744ad0065@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Huge tables, trying to delete OID's taking 6+hours per table
  In-Reply-To: <0c0d572a-95ad-42ec-6977-8cd744ad0065@gmail.com>
  References: <CAEaSS0YMuvA_J8LOLWwxFaxVAFhgezekB3vQycywQdiiDud2Hg@mail.gmail.com> <CAEaSS0Yzm0F9w+tWPOX5OHWRq44-s1Tn0kKsEV0hjniYeWDC_A@mail.gmail.com> <27067.1589895643@sss.pgh.pa.us> <CAEaSS0YNA4XL5JkFB2H8_+FZ2LcEyCFAkRgUkoW6s6Ubxbmt3Q@mail.gmail.com> <0c0d572a-95ad-42ec-6977-8cd744ad0065@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox