From: hubert depesz lubaczewski <depesz@depesz.com>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Re: PostgreSQL (9.3 and 9.6) eats all memory when using many tables
Date: Mon, 13 Jun 2016 18:45:09 +0200
Message-ID: <20160613164509.GA26282@depesz.com> (raw)
In-Reply-To: <CAMkU=1zgAUMfcxXYD6cGzpxpzAzZS3fJ7SHeUsmLmYQP2Cu7EA@mail.gmail.com>
References: <20160609154610.GA20600@depesz.com>
<CAMkU=1xOLwvzXDgw8=QAa-oEONmCtjoP7O-=CVqN3Cv2o41kyw@mail.gmail.com>
<20160613093907.GA10381@depesz.com>
<CAMkU=1zgAUMfcxXYD6cGzpxpzAzZS3fJ7SHeUsmLmYQP2Cu7EA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On Mon, Jun 13, 2016 at 09:27:40AM -0700, Jeff Janes wrote:
> On Mon, Jun 13, 2016 at 2:39 AM, hubert depesz lubaczewski
> <depesz@depesz.com> wrote:
> > On Sun, Jun 12, 2016 at 01:50:48PM -0700, Jeff Janes wrote:
>
> >
> > Line #2 shows output of ps nh uww -p <backend_pid> before start of work.
> > There are, in total, 74002 tables, and then I iterate over list of them,
> > and for each, I do the select I mentioned.
> >
> > Every 1000 tables, I get stats - ps output, and (in parent) sum of
> > "Anonymous:" lines from /proc/<backend_pid>/smaps.
> >
> > As you can see - we're getting ~ 32kB of cache per table.
>
> What hardware and OS are you using? I only get a bit over 8kB per
> table, and that amount doesn't change much between 9.3 and 9.6.
These are 64bit aws virtual boxes (ec2, not rds) using ubuntu trusty.
Pg is from ubuntu repo.
> Can you share a representative table definition, including constraints?
There are ~ 180 different tables, each looking different, and they are
copied (schema, not data) across ~ 400 schemas.
some tables have 1 index, some have up to 17.
The 17 index table looks like this (sorry, had to redact it heavily):
Column | Type | Modifiers
--------------------------------------+-----------------------------+---------------------------------------------------------------------------
id | bigint | not null default nextval('...................................'::regclass)
.... | character varying(255) |
.......... | bigint | not null
...................... | character varying(255) |
.............. | character varying(255) | not null
.... | character varying(255) |
........ | timestamp without time zone |
........... | timestamp without time zone |
................... | bigint |
......... | boolean |
........................ | boolean |
.......... | timestamp without time zone |
.......... | timestamp without time zone |
............................ | boolean |
............. | text |
............................... | boolean | default false
.......................... | character varying(255) |
....... | bigint |
.............................. | boolean | default true
........... | character varying(255) |
............ | character varying(255) | default '....'::character varying
.................. | bigint |
............... | bigint | not null
.................. | bigint | not null
............. | character varying(255) |
............ | bigint |
............... | boolean |
............. | bigint |
................. | text |
................... | boolean |
................. | text |
............... | boolean |
....... | character varying(255) |
....... | boolean |
.................................... | boolean |
.................. | bigint |
...... | character varying(255) |
........ | text |
..................... | bigint |
................ | text |
.................. | text |
.................... | character varying(255) |
..................... | integer |
.............. | character varying(255) |
......... | character varying(255) |
.............. | character varying(255) |
........... | bigint |
and on this there are 17 indexes, 7 fkeys, and it is being referenced by 15 other tables.
Best regards,
depesz
--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: depesz@depesz.com, jeff.janes@gmail.com
Subject: Re: PostgreSQL (9.3 and 9.6) eats all memory when using many tables
In-Reply-To: <20160613164509.GA26282@depesz.com>
References: <20160609154610.GA20600@depesz.com> <CAMkU=1xOLwvzXDgw8=QAa-oEONmCtjoP7O-=CVqN3Cv2o41kyw@mail.gmail.com> <20160613093907.GA10381@depesz.com> <CAMkU=1zgAUMfcxXYD6cGzpxpzAzZS3fJ7SHeUsmLmYQP2Cu7EA@mail.gmail.com> <20160613164509.GA26282@depesz.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