pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Pyhalov <alp@sfedu.ru>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: PostgreSQL memory usage
Date: Thu, 17 Oct 2019 14:40:15 +0200
Message-ID: <20765.1571316015@sss.pgh.pa.us> (raw)
In-Reply-To: <AM6PR05MB6198588E81ED27FE0C8A3396CF6D0@AM6PR05MB6198.eurprd05.prod.outlook.com>
References: <AM6PR05MB61985241B3104D09D7A992F6CF920@AM6PR05MB6198.eurprd05.prod.outlook.com>
	<9d662d4588db8f77f8bb2c9bab360f77021aadc5.camel@cybertec.at>
	<AM6PR05MB6198588E81ED27FE0C8A3396CF6D0@AM6PR05MB6198.eurprd05.prod.outlook.com>

Alexander Pyhalov <alp@sfedu.ru> writes:
> However, one table has 2250 partitions and I've seen several selects to this table (based on the  primary key of individual partitions) with a huge IN ()  list (about 500 keys). Don't expect this to be efficient, but unsure that these queries caused such memory consumption.

Yeah, it could be that it's just the number of partitions involved in
the query that's causing the memory bloat.  v10 is not bright about
pruning uninteresting partitions from a query (v12 is better), so
there will be 2250 tables involved so far as the planner and executor
are concerned.  And then if you've got a large/complex WHERE clause,
that's probably copied and modified for each of those tables :-(.

We don't generally recommend having more than a hundred or so partitions,
because of issues like this.  v12 is starting to make it feasible to have
more, but only in limited use-cases.

			regards, tom lane





view thread (5+ messages)

Message-ID: <20765.1571316015@sss.pgh.pa.us>
Permalink:  ../20765.1571316015@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20765.1571316015@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, alp@sfedu.ru, laurenz.albe@cybertec.at
  Subject: Re: PostgreSQL memory usage
  In-Reply-To: <20765.1571316015@sss.pgh.pa.us>
  References: <AM6PR05MB61985241B3104D09D7A992F6CF920@AM6PR05MB6198.eurprd05.prod.outlook.com> <9d662d4588db8f77f8bb2c9bab360f77021aadc5.camel@cybertec.at> <AM6PR05MB6198588E81ED27FE0C8A3396CF6D0@AM6PR05MB6198.eurprd05.prod.outlook.com> <20765.1571316015@sss.pgh.pa.us>

* 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