pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: shirshegsm@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14263: Query planner is slow to plan UPDATE on a table with many partitions
Date: Fri, 22 Jul 2016 14:39:23 +0100
Message-ID: <878twtsssp.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <20160722062029.7448.19810@wrigleys.postgresql.org>
References: <20160722062029.7448.19810@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

>>>>> "shirshegsm" == shirshegsm  <shirshegsm@gmail.com> writes:

 shirshegsm> After some discussion on #postgresql @ Freenode (abridged
 shirshegsm> version: https://paste.fedoraproject.org/393752/16805914/),
 shirshegsm> it seems that the query planner has O(n^2) complexity for
 shirshegsm> the number of partitions in a partitioned table.

To sum up my part of that discussion: the repeated calls to
adjust_appendrel_attrs cause an O(N^2) number of calls to palloc, as
query_tree_mutator calls range_table_mutator which does two pallocs per
RTE (one for the RTE and one for the listcell).

Also none of those get freed, as far as I can tell, so the memory usage
is O(N^2) too.

-- 
Andrew (irc:RhodiumToad)


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)  latest in thread

Message-ID: <878twtsssp.fsf@news-spur.riddles.org.uk>
Permalink:  ../878twtsssp.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/878twtsssp.fsf@news-spur.riddles.org.uk

 · 

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-bugs@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, shirshegsm@gmail.com
  Subject: Re: BUG #14263: Query planner is slow to plan UPDATE on a table with many partitions
  In-Reply-To: <878twtsssp.fsf@news-spur.riddles.org.uk>
  References: <20160722062029.7448.19810@wrigleys.postgresql.org> <878twtsssp.fsf@news-spur.riddles.org.uk>

* 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