Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzWRZ-0003or-80 for pgsql-admin@arkaria.postgresql.org; Wed, 26 Oct 2016 22:13:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bzWRY-0007T7-Qx for pgsql-admin@arkaria.postgresql.org; Wed, 26 Oct 2016 22:13:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bzWRY-0007T0-8v for pgsql-admin@postgresql.org; Wed, 26 Oct 2016 22:13:08 +0000 Received: from internet06.ebureau.com ([65.127.24.25]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzWRV-00019v-JB for pgsql-admin@postgresql.org; Wed, 26 Oct 2016 22:13:07 +0000 Received: from localhost (localhost [127.0.0.1]) by internet06.ebureau.com (Postfix) with ESMTP id 71CD3666BA8A; Wed, 26 Oct 2016 17:13:04 -0500 (CDT) X-Virus-Scanned: amavisd-new at ebureau.com Received: from internet06.ebureau.com ([127.0.0.1]) by localhost (internet06.ebureau.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UBVQJ6J2Z5Gw; Wed, 26 Oct 2016 17:13:03 -0500 (CDT) Received: from [172.16.2.113] (unknown [67.148.93.60]) by internet06.ebureau.com (Postfix) with ESMTPSA id 3C62E666BA73; Wed, 26 Oct 2016 17:13:02 -0500 (CDT) From: Natalie Wenz Content-Type: multipart/alternative; boundary="Apple-Mail=_F1FA5C07-C46D-444F-91AC-1BE8EE4C99DC" Message-Id: <8B647628-89BE-43FE-B538-973BF85A79A9@ebureau.com> Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: pg_toast oid limits Date: Wed, 26 Oct 2016 17:12:59 -0500 References: <24095.1477509777@sss.pgh.pa.us> To: pgsql-admin , Tom Lane , "Joshua D. Drake" , david.g.johnston@gmail.com In-Reply-To: <24095.1477509777@sss.pgh.pa.us> X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --Apple-Mail=_F1FA5C07-C46D-444F-91AC-1BE8EE4C99DC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thanks, I'm running that now. (/twiddles thumbs) The disks are pretty = much saturated at the moment, so everything is taking a long time.=20 I'm a little confused about the limit. Is it 4 billion oids for the = whole database, or just per table? I keep coming back to this line, from = https://wiki.postgresql.org/wiki/TOAST :=20 "If you exceed 4 billion of these rows across all tables (remember this = is a global shared wrapping counter), then the OID counter "wraps" which = might cause significant slowdown as you approach the 4B row limit." We are actually in the process of attempting to create new tables (one = for each of these large columns in this large table), and this process = may have actually accelerated our use of oids, if it's a global pool. Thanks for your help! Natalie > On Oct 26, 2016, at 2:22 PM, Tom Lane wrote: >=20 > Natalie Wenz writes: >> I am seeing some performance issues that I'm trying to track down on = a large database. One of the things I'm beginning to suspect is a = particularly large table with many columns, about 200 of which (type = text) contain large chunks of data. Now, for a given row, maybe 10-30 of = those columns contain data, so not all 200 for each row, but the data = can still be pretty sizable. There are currently around 750 million = records in this table (and is about 22TB in size). I was trying to learn = more about toast, and I see some references in the wiki and the hackers = list to performance issues when you approach the 4 billion oids for a = single table (which, I gather, are used when the data is toasted). Given = my rudimentary understanding of how the whole toast thing works, I was = wondering if there is a way to see how many oids are used for a table, = or another way to know if we're running into toast limits for a single = table. >=20 > You could do >=20 > select reltoastrelid::regclass from pg_class where relname =3D = 'problem_table'; >=20 > which will give you something like >=20 > reltoastrelid =20 > ------------------------- > pg_toast.pg_toast_78004 >=20 > and then poke into the contents of that table. Probably >=20 > select count(distinct chunk_id) from pg_toast.pg_toast_78004; >=20 > would answer your immediate question. >=20 > regards, tom lane --Apple-Mail=_F1FA5C07-C46D-444F-91AC-1BE8EE4C99DC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Thanks, I'm running that now. (/twiddles thumbs) The disks = are pretty much saturated at the moment, so everything is taking a long = time. 

I'm a = little confused about the limit. Is it 4 billion oids for the whole = database, or just per table? I keep coming back to this line, = from https://wiki.postgresql.org/wiki/TOAST : 

"If you exceed 4 billion of these rows across all tables = (remember this is a global shared wrapping counter), then the OID = counter "wraps" which might cause significant slowdown as you approach = the 4B row limit."

We are actually in the process of attempting to = create new tables (one for each of these large columns in this large = table), and this process may have actually accelerated our use of = oids, if it's a global pool.

Thanks for = your help!
Natalie


On Oct 26, 2016, at 2:22 PM, = Tom Lane <tgl@sss.pgh.pa.us> wrote:

Natalie Wenz <nataliewenz@ebureau.com> writes:
I am seeing some = performance issues that I'm trying to track down on a large database. = One of the things I'm beginning to suspect is a particularly large table = with many columns, about 200 of which (type text) contain large chunks = of data. Now, for a given row, maybe 10-30 of those columns contain = data, so not all 200 for each row, but the data can still be pretty = sizable. There are currently around 750 million records in this table = (and is about 22TB in size). I was trying to learn more about toast, and = I see some references in the wiki and the hackers list to performance = issues when you approach the 4 billion oids for a single table (which, I = gather, are used when the data is toasted). Given my rudimentary = understanding of how the whole toast thing works, I was wondering if = there is a way to see how many oids are used for a table, or another way = to know if we're running into toast limits for a single table.

You could do

select reltoastrelid::regclass from pg_class where relname =3D = 'problem_table';

which will give you = something like

=      reltoastrelid =      
-------------------------
pg_toast.pg_toast_78004

and = then poke into the contents of that table.  Probably

select count(distinct chunk_id) from = pg_toast.pg_toast_78004;

would answer your = immediate question.

regards, = tom lane

= --Apple-Mail=_F1FA5C07-C46D-444F-91AC-1BE8EE4C99DC--