pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to clean dropped column in pg_attribute
3+ messages / 2 participants
[nested] [flat]

* how to clean dropped column in pg_attribute
@ 2020-09-08 09:38  ZongtianHou <zongtianhou@icloud.com>
  0 siblings, 1 reply; 3+ messages in thread

From: ZongtianHou @ 2020-09-08 09:38 UTC (permalink / raw)
  To: pgsql-admin

Hi, everyone

I found dropped columns still exist in pg_attribute table. In the below example I drop c2 column and vacuum (full) this table and pg_attribute, it still exist (the last row). how can I clean it away? 

postgres=# select * from pg_attribute where attrelid=16515;
 attrelid |           attname            | atttypid | attstattarget | attlen | attnum | attndims | attcacheoff | atttypmod | attbyval | attstorage | attalign | attnotnull | atthasdef | attisdropped | attislocal | attinhcount
----------+------------------------------+----------+---------------+--------+--------+----------+-------------+-----------+----------+------------+----------+------------+-----------+--------------+------------+-------------
    16515 | c1                           |       23 |            -1 |      4 |      1 |        0 |          -1 |        -1 | t        | p          | i        | f          | f         | f            | t          |           0
    16515 | c3                           |       23 |            -1 |      4 |      3 |        0 |          -1 |        -1 | t        | p          | i        | f          | f         | f            | t          |           0
    16515 | ctid                         |       27 |             0 |      6 |     -1 |        0 |          -1 |        -1 | f        | p          | s        | t          | f         | f            | t          |           0
    16515 | xmin                         |       28 |             0 |      4 |     -3 |        0 |          -1 |        -1 | t        | p          | i        | t          | f         | f            | t          |           0
    16515 | cmin                         |       29 |             0 |      4 |     -4 |        0 |          -1 |        -1 | t        | p          | i        | t          | f         | f            | t          |           0
    16515 | xmax                         |       28 |             0 |      4 |     -5 |        0 |          -1 |        -1 | t        | p          | i        | t          | f         | f            | t          |           0
    16515 | cmax                         |       29 |             0 |      4 |     -6 |        0 |          -1 |        -1 | t        | p          | i        | t          | f         | f            | t          |           0
    16515 | tableoid                     |       26 |             0 |      4 |     -7 |        0 |          -1 |        -1 | t        | p          | i        | t          | f         | f            | t          |           0
    16515 | gp_segment_id                |       23 |             0 |      4 |     -8 |        0 |          -1 |        -1 | t        | p          | i        | t          | f         | f            | t          |           0
    16515 | c4                           |       16 |            -1 |      1 |      4 |        0 |          -1 |        -1 | t        | p          | c        | f          | f         | f            | t          |           0
    16515 | ........pg.dropped.2........ |        0 |             0 |      4 |      2 |        0 |          -1 |        -1 | t        | p          | i        | f          | f         | t            | t          |           0
(11 rows)




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: how to clean dropped column in pg_attribute
@ 2020-09-08 09:49  hubert depesz lubaczewski <depesz@depesz.com>
  parent: ZongtianHou <zongtianhou@icloud.com>
  0 siblings, 1 reply; 3+ messages in thread

From: hubert depesz lubaczewski @ 2020-09-08 09:49 UTC (permalink / raw)
  To: ZongtianHou <zongtianhou@icloud.com>; +Cc: pgsql-admin

On Tue, Sep 08, 2020 at 05:38:24PM +0800, ZongtianHou wrote:
> I found dropped columns still exist in pg_attribute table. In the
> below example I drop c2 column and vacuum (full) this table and
> pg_attribute, it still exist (the last row). how can I clean it away? 

Unfortunately only by copying the table aside, and then renaming new
table.

But - the dropped attribute will not sure any disk space, as long as you
ran some vacuums.

Best regards,

depesz






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: how to clean dropped column in pg_attribute
@ 2020-09-08 09:51  ZongtianHou <zongtianhou@icloud.com>
  parent: hubert depesz lubaczewski <depesz@depesz.com>
  0 siblings, 0 replies; 3+ messages in thread

From: ZongtianHou @ 2020-09-08 09:51 UTC (permalink / raw)
  To: depesz@depesz.com; +Cc: pgsql-admin

Ok, thanks for this info

Best regards,
Zongtian

> On Sep 8, 2020, at 5:49 PM, hubert depesz lubaczewski <depesz@depesz.com> wrote:
> 
> On Tue, Sep 08, 2020 at 05:38:24PM +0800, ZongtianHou wrote:
>> I found dropped columns still exist in pg_attribute table. In the
>> below example I drop c2 column and vacuum (full) this table and
>> pg_attribute, it still exist (the last row). how can I clean it away? 
> 
> Unfortunately only by copying the table aside, and then renaming new
> table.
> 
> But - the dropped attribute will not sure any disk space, as long as you
> ran some vacuums.
> 
> Best regards,
> 
> depesz
> 






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-09-08 09:51 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 09:38 how to clean dropped column in pg_attribute ZongtianHou <zongtianhou@icloud.com>
2020-09-08 09:49 ` hubert depesz lubaczewski <depesz@depesz.com>
2020-09-08 09:51   ` ZongtianHou <zongtianhou@icloud.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