pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Daniel Verite <daniel@manitou-mail.org>
To: Charles Martin <ssappeals@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Trouble Upgrading Postgres
Date: Tue, 6 Nov 2018 06:39:05 -0800
Message-ID: <6befdc47-e00c-37d2-09da-80adc445460b@aklaver.com> (raw)
In-Reply-To: <ce239c9c-68f2-43e6-a6b6-81c66d0f46e5@manitou-mail.org>
References: <ce239c9c-68f2-43e6-a6b6-81c66d0f46e5@manitou-mail.org>

On 11/6/18 3:47 AM, Daniel Verite wrote:
> 	Charles Martin wrote:
> 
>>   but the second one returned this:
>>
>> 0 "623140"
>> 1 "53"
>> 2 "12"
>> 3 "10"
>> 4 "1"
>> 5 "1"
>> 7 "1"
>> [null] "162"
>>
>> Not quite sure what that means, but if there is just a small number of
>> overly-large records, I might be able to delete them. If I can find them.
> 
> The query was:
> 
>    SELECT octet_length(docfilecontents)/(1024*1024*100),
> 	       count(*)
>     FROM docfile
>     GROUP BY octet_length(docfilecontents)/(1024*1024*100);
> 
> The results above show that there is one document weighing over 700 MB
> (the first column being the multiple of 100MB), one between 500 and
> 600 MB, one between 400 MB and 500 MB, 10 between 300 and 400 MB, and
> so on.
> 
> The hex expansion performed by COPY must allocate twice that size,
> plus the rest of the row, and if that resulting size is above 1GB, it
> will error out with the message you mentioned upthread:
> ERROR: invalid memory alloc request size <some value over 1 billion>.
> So there's no way it can deal with the contents over 500MB, and the
> ones just under that limit may also be problematic.

To me that looks like a bug, putting data into a record you cannot get out.

> 
> A quick and dirty way of getting rid of these contents would be to
> nullify them. For instance, nullify anything over 400MB:
> 
> UPDATE docfile SET docfilecontents=NULL
>    WHERE octet_length(docfilecontents) > 1024*1024*400;
> 
> Or a cleaner solution would be to delete them with the application if
> that's possible. You may turn the above query into a SELECT that
> retrieve the fields of interest (avoid SELECT * because of the huge
> column).
> 
> 
> Best regards,
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (35+ messages)  latest in thread

Message-ID: <6befdc47-e00c-37d2-09da-80adc445460b@aklaver.com>
Permalink:  ../6befdc47-e00c-37d2-09da-80adc445460b@aklaver.com/
Also on:    postgresql.org/message-id/6befdc47-e00c-37d2-09da-80adc445460b@aklaver.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: adrian.klaver@aklaver.com, daniel@manitou-mail.org, ssappeals@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Trouble Upgrading Postgres
  In-Reply-To: <6befdc47-e00c-37d2-09da-80adc445460b@aklaver.com>
  References: <ce239c9c-68f2-43e6-a6b6-81c66d0f46e5@manitou-mail.org> <6befdc47-e00c-37d2-09da-80adc445460b@aklaver.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