pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedHuge tables, trying to delete OID's taking 6+hours per table
7+ messages / 3 participants
[nested] [flat]
* Huge tables, trying to delete OID's taking 6+hours per table
@ 2020-05-19 07:17 Tory M Blue <tmblue@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Tory M Blue @ 2020-05-19 07:17 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
The db is only 2TB, these tables are about 50% of the DB.
Just wondering what I can boost to give me some elevated temp performance
for what I would think would be a fairly quick operation.
Give this query more work_mem? Mine are set pretty low, based on previous
performance notes, this is a 9.5 server.
Thanks
Tory
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Huge tables, trying to delete OID's taking 6+hours per table
@ 2020-05-19 07:36 Tory M Blue <tmblue@gmail.com>
parent: Tory M Blue <tmblue@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Tory M Blue @ 2020-05-19 07:36 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, May 19, 2020 at 12:17 AM Tory M Blue <tmblue@gmail.com> wrote:
>
> The db is only 2TB, these tables are about 50% of the DB.
>
>
> Just wondering what I can boost to give me some elevated temp performance
> for what I would think would be a fairly quick operation.
>
> Give this query more work_mem? Mine are set pretty low, based on previous
> performance notes, this is a 9.5 server.
>
> Thanks
> Tory
>
The command i'm using is
ALTER TABLE tablename SET WITHOUT OIDS;
Would a drop column oid be better?
Tory
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Huge tables, trying to delete OID's taking 6+hours per table
@ 2020-05-19 13:40 Tom Lane <tgl@sss.pgh.pa.us>
parent: Tory M Blue <tmblue@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2020-05-19 13:40 UTC (permalink / raw)
To: Tory M Blue <tmblue@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Tory M Blue <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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Huge tables, trying to delete OID's taking 6+hours per table
@ 2020-05-19 16:51 Tory M Blue <tmblue@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 7+ messages in thread
From: Tory M Blue @ 2020-05-19 16:51 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, May 19, 2020 at 6:40 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Tory M Blue <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?
Thanks again Tom
Tory
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Huge tables, trying to delete OID's taking 6+hours per table
@ 2020-05-19 17:06 Ron <ronljohnsonjr@gmail.com>
parent: Tory M Blue <tmblue@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Ron @ 2020-05-19 17:06 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Huge tables, trying to delete OID's taking 6+hours per table
@ 2020-05-20 16:22 Tory M Blue <tmblue@gmail.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Tory M Blue @ 2020-05-20 16:22 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Tue, May 19, 2020 at 10:06 AM Ron <ronljohnsonjr@gmail.com> wrote:
> 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> wrote:
>
>> Tory M Blue <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.
>
Thanks Ron,
Looked into this but we have large indexes that take 8-12 hours to create.
So my gut says this would not buy us anytime. Also this has been running
for 16 hours now and still not done. I think it's forcing index creation
regardless. Really a crappy situation!!!
Tory
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Huge tables, trying to delete OID's taking 6+hours per table
@ 2020-05-20 16:37 Ron <ronljohnsonjr@gmail.com>
parent: Tory M Blue <tmblue@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: Ron @ 2020-05-20 16:37 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On 5/20/20 11:22 AM, Tory M Blue wrote:
>
>
> On Tue, May 19, 2020 at 10:06 AM Ron <ronljohnsonjr@gmail.com
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
> 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.
>
>
> Thanks Ron,
>
> Looked into this but we have large indexes that take 8-12 hours to create.
> So my gut says this would not buy us anytime.
Since the index creation would be separate from your application's access,
it doesn't actually matter.
> Also this has been running for 16 hours now and still not done. I think
> it's forcing index creation regardless.
>
If it's rewriting the table's pages, then the indexes must be rewritten, too,
When removing OIDs, is the priority to minimize absolute time, or to
minimize downtime/degradation as sen by the application?
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2020-05-20 16:37 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 07:17 Huge tables, trying to delete OID's taking 6+hours per table Tory M Blue <tmblue@gmail.com>
2020-05-19 07:36 ` Tory M Blue <tmblue@gmail.com>
2020-05-19 13:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-05-19 16:51 ` Tory M Blue <tmblue@gmail.com>
2020-05-19 17:06 ` Ron <ronljohnsonjr@gmail.com>
2020-05-20 16:22 ` Tory M Blue <tmblue@gmail.com>
2020-05-20 16:37 ` Ron <ronljohnsonjr@gmail.com>
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