Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK2Vh-0004ex-NK for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 14:39:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gK2Vg-0006wb-0l for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 14:39:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK2Vf-0006wO-OJ for pgsql-general@lists.postgresql.org; Tue, 06 Nov 2018 14:39:15 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK2Vd-0008AA-ID for pgsql-general@postgresql.org; Tue, 06 Nov 2018 14:39:14 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 3AB57101D; Tue, 6 Nov 2018 09:39:11 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 06 Nov 2018 09:39:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=g Las1L8tS/7ch8qVMmQnb5IcKPiIPR/iIyPml5NLRx8=; b=i4Pj8ZbHCl0i9s8LR Sja6nF3VJp4DiHw9Y+T93+tWAoNC7ihHXVAXgfwNt8wCL1slC78lVe+zjD0FH24D i8TWFYmYiYxjLSibLFN7TLzG1vi9HRJr0LqoulVxa66rF0387BNzSoX1leXZbGbw qKwertmclls2yZGqpfXD8WKqXq8YNqH840m4DdEwoxsYeub4TkJJNr4n4zTakAOu NxVhuAq+MvOeeS+tENLSBdVVlyqa5nL0t/NAI6EI3UfZkouc9wkTGPmLoAiksDV8 REDEtM7T1IfC/9l3dt/44zKNsAmDCj7u8+ZDzdOvFwznsZ57QPUBBVNQXWMd3oA+ 8aTfA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=gLas1L8tS/7ch8qVMmQnb5IcKPiIPR/iIyPml5NLR x8=; b=ZQjxuquxjIVyZv/7We4c6gljEs9eM1wTjh8qQzVOCYqTCk83oDhsueSYu wrzWYB4OP/vHmTmdXLaFZuS8gntfKXwMtIG7OSxUx6bQSblFJCxQc6DRx7UqiEZC gV8Hkh0yyd7dA0Qevxv4qvedm9bL6bdAVE4vi0IqdNgJoRuHJHxyvfYAVHrd3aJ3 chtanTevCggaZqvQGohaRgFALiMFcJ8T65sccbwjnD0p+0cNQbb2ZiNL+5bkPgrM /wHd/+9jw1LQYeHpglX6xtZybe72RmFQIwVdm7JRSh7gownDJAfxaXMvtR2nq3d3 ESNOqmveEvjafA33z9AaYbzNco5RA== X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id AE2C0E4ABC; Tue, 6 Nov 2018 09:39:09 -0500 (EST) Subject: Re: Trouble Upgrading Postgres To: Daniel Verite , Charles Martin Cc: Tom Lane , pgsql-general References: From: Adrian Klaver Message-ID: <6befdc47-e00c-37d2-09da-80adc445460b@aklaver.com> Date: Tue, 6 Nov 2018 06:39:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 . > 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