pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Moradhassel, Kavian <kmoradha@ciena.com>
To: Wells Oliver <wells.oliver@gmail.com>
To: nunks <nunks.lol@gmail.com>
Cc: Scott Ribe <scott_ribe@elevated-dev.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: [**EXTERNAL**] Re: [pgsql-admin] "Soft-hitting" the 1600 column limit
Date: Wed, 6 Jun 2018 18:54:11 +0000
Message-ID: <05FBE51B-5256-4756-8AE2-98850D3163AF@ciena.com> (raw)
In-Reply-To: <CAOC+FBX6JLtcz-vO7K1rB-qmn23MyVgHya5xgcYLX-yUYoM_xw@mail.gmail.com>
References: <CACq6szQbQDG6_mThyH32=6J0e99-KdqOrhZMm9QwvGoVFzNbBw@mail.gmail.com>
	<CAOC+FBXehj4X2DMfytnPKHRWrWWZjq1G9OfUXsMop5Tex7hrvg@mail.gmail.com>
	<3C61E858-5CA7-405D-B32A-B4C89D1AC62E@elevated-dev.com>
	<CACq6szR7Q--tw67ZJL4-T59oAXCLXgmCDFVh=FunY3N4HCDLXg@mail.gmail.com>
	<CAOC+FBX6JLtcz-vO7K1rB-qmn23MyVgHya5xgcYLX-yUYoM_xw@mail.gmail.com>

To my mind, it makes perfect sense for columns to persist in the table structure when dropped…the only question I have is whether the column would survive a VACUUM FULL?  i.e. if the table is rewritten after the column is dropped, would that change things?

Kav Moradhassel | Ciena
kmoradha@ciena.com<mailto:kmoradha@ciena.com> | 385 Terry Fox Drive | Ottawa, ON, K2K 0L1  Canada


From: Wells Oliver <wells.oliver@gmail.com>
Date: Wednesday, June 6, 2018 at 2:46 PM
To: nunks <nunks.lol@gmail.com>
Cc: Scott Ribe <scott_ribe@elevated-dev.com>, pgsql-admin <pgsql-admin@postgresql.org>
Subject: [**EXTERNAL**] Re: [pgsql-admin] "Soft-hitting" the 1600 column limit

Is there a pointer to some deeper explanation of this? It's news to me and kind of fascinating that dropped columns don't disappear. I did this stupid test, which obviously failed:

mydb=# create table wells.foo (col1 text, col2 text);
CREATE TABLE
mydb=# insert into wells.foo values ('a','b'),('c','d');
INSERT 0 2
mydb=# alter table wells.foo drop column col2;
ALTER TABLE
mydb=# insert into wells.foo (col1,col2) values('a','b');
ERROR:  column "col2" of relation "foo" does not exist
LINE 1: insert into wells.foo (col1,col2) values('a','b');

Just curious then, in what meaningful way do dropped columns persist, what are the reasons?

On Wed, Jun 6, 2018 at 10:13 AM, nunks <nunks.lol@gmail.com<mailto:nunks.lol@gmail.com>> wrote:
Thank you all for your answers.


David and Tom's answers are more than enough to feed my argument to the developers. =)


Scott, you're right of course. My first action to reestablish their development database was to do a dump/restore, but by logging DML statements I can see the application is dropping and adding the same column over and over again, so it's a matter of time before it hangs. I hope showing this thread to the developers will make them see some sense.


@Wells, don't ask me, I have no idea, hahah, but it's a small table and the application keeps dropping/readding the column, actually. I figure the developer is using some kind of crazy ORM that drops the column when he deletes an object property and re-adds it when he sets the property back or something.


@Ervin, a vacuum full doesn't "fix" this behavior, since it's expected after all =)


collimittest=# \d add_drop_text
          Table "public.add_drop_text"
 Column | Type | Collation | Nullable | Default
--------+------+-----------+----------+---------
 fixed  | text |           |          |

collimittest=# vacuum FULL ANALYZE VERBOSE add_drop_text ;
INFO:  vacuuming "public.add_drop_text"
INFO:  "add_drop_text": found 0 removable, 0 nonremovable row versions in 0 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  analyzing "public.add_drop_text"
INFO:  "add_drop_text": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
VACUUM
collimittest=# alter table add_drop_text add column x int;
ERROR:  tables can have at most 1600 columns


----------
“Life beats down and crushes the soul and art reminds you that you have one.”

- Stella Adler


On Wed, Jun 6, 2018 at 1:57 PM, Scott Ribe <scott_ribe@elevated-dev.com<mailto:scott_ribe@elevated-dev.com>> wrote:
He's *NOT* doing anything that requires 1600 columns--that was pretty much the point of his post.

--
Scott Ribe
scott_ribe@elevated-dev.com<mailto:scott_ribe@elevated-dev.com>
https://www.linkedin.com/in/scottribe/


> On Jun 6, 2018, at 10:53 AM, Wells Oliver <wells.oliver@gmail.com<mailto:wells.oliver@gmail.com>> wrote:
>
> let's just stop for a moment and talk about what you're doing that requires *1600 columns* because my jaw is hitting the floor.




--
Wells Oliver
wells.oliver@gmail.com<mailto:wellsoliver@gmail.com>


view thread (14+ messages)  latest in thread

Message-ID: <05FBE51B-5256-4756-8AE2-98850D3163AF@ciena.com>
Permalink:  ../05FBE51B-5256-4756-8AE2-98850D3163AF@ciena.com/
Also on:    postgresql.org/message-id/05FBE51B-5256-4756-8AE2-98850D3163AF@ciena.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-admin@postgresql.org
  Cc: kmoradha@ciena.com, wells.oliver@gmail.com, nunks.lol@gmail.com, scott_ribe@elevated-dev.com
  Subject: Re: [**EXTERNAL**] Re: [pgsql-admin] "Soft-hitting" the 1600 column limit
  In-Reply-To: <05FBE51B-5256-4756-8AE2-98850D3163AF@ciena.com>
  References: <CACq6szQbQDG6_mThyH32=6J0e99-KdqOrhZMm9QwvGoVFzNbBw@mail.gmail.com> <CAOC+FBXehj4X2DMfytnPKHRWrWWZjq1G9OfUXsMop5Tex7hrvg@mail.gmail.com> <3C61E858-5CA7-405D-B32A-B4C89D1AC62E@elevated-dev.com> <CACq6szR7Q--tw67ZJL4-T59oAXCLXgmCDFVh=FunY3N4HCDLXg@mail.gmail.com> <CAOC+FBX6JLtcz-vO7K1rB-qmn23MyVgHya5xgcYLX-yUYoM_xw@mail.gmail.com> <05FBE51B-5256-4756-8AE2-98850D3163AF@ciena.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