pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
To: pgsql-performance@postgresql.org
Subject: Re: In progress INSERT wrecks plans on table
Date: Sat, 11 May 2013 16:58:47 +1200
Message-ID: <518DD007.4000006@catalyst.net.nz> (raw)
In-Reply-To: <3833.1368192658@sss.pgh.pa.us>
References: <5179E77B.7050601@catalyst.net.nz>
	<5179ECC5.2010206@archidevsys.co.nz>
	<5179F259.3010509@catalyst.net.nz>
	<5179F5C6.8070702@archidevsys.co.nz>
	<5180E3C8.3010201@catalyst.net.nz>
	<2121.1367417215@sss.pgh.pa.us>
	<5181B80D.70404@catalyst.net.nz>
	<CA+U5nMKYYZDekhtxz1E1B11dAm9UJoHBQHrB6DiiZDJo3fLd0Q@mail.gmail.com>
	<916bff05a5ab130c76d7835abbaf7762.squirrel@mail.catalyst.net.nz>
	<CA+U5nMJHjQccVSB3SkAHdRn2AfuuO49wA8-ZGB366cddTynjdQ@mail.gmail.com>
	<CA+U5nMKMfZUEimZ9=oF2wJ-WkiGhMw3mQjUFT6PBGofUpmXL8A@mail.gmail.com>
	<51870CB6.6090404@catalyst.net.nz>
	<CA+U5nMJHgHczmWrKzst=PJeP+9BHJAsTgRNXyVZX5Oyys2zn_g@mail.gmail.com>
	<feb60a4b1d9e3af7b646b0274064a1d9.squirrel@mail.catalyst.net.nz>
	<CA+U5nMJqUHE-t5eBuMZGu-_0rJbfoqrYJ=oi_xvKhrq8_31F2A@mail.gmail.com>
	<51889FF4.7000306@catalyst.net.nz>
	<CABWW-d3A3r6sQW71phLJqGkZBdbWOxo+WsrA3qwpx3F5KYRM1g@mail.gmail.com>
	<518CED48.1030706@catalyst.net.nz>
	<3833.1368192658@sss.pgh.pa.us>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 11/05/13 01:30, Tom Lane wrote:
> Mark Kirkwood <mark.kirkwood@catalyst.net.nz> writes:
>> Unfortunately a trigger will not really do the job - analyze ignores in
>> progress rows (unless they were added by the current transaction), and
>> then the changes made by analyze are not seen by any other sessions. So
>> no changes to plans until the entire INSERT is complete and COMMIT
>> happens (which could be a while - too long in our case).
>
> I'm not sure I believe the thesis that plans won't change at all.
> The planner will notice that the physical size of the table is growing.
> That may not be enough, if the table-contents statistics are missing
> or completely unreflective of reality, but it's something.
>
> It is true that *already cached* plans won't change until after an
> ANALYZE is done (the key point there being that ANALYZE sends out a
> shared-inval message to force replanning of plans for the table).
> Conceivably you could issue concurrent ANALYZEs occasionally while
> the INSERT is running, not so much to update the stats --- because
> they wouldn't --- as to force cached-plan invalidation.

Yeah - true, I was focusing on the particular type of query illustrated 
in the test case - pretty much entirely needing updated selectivity 
stats for a column, which wouldn't change unfortunately.

Cheers

Mark



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



view thread (42+ messages)  latest in thread

Message-ID: <518DD007.4000006@catalyst.net.nz>
Permalink:  ../518DD007.4000006@catalyst.net.nz/
Also on:    postgresql.org/message-id/518DD007.4000006@catalyst.net.nz

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mark.kirkwood@catalyst.net.nz
  Subject: Re: In progress INSERT wrecks plans on table
  In-Reply-To: <518DD007.4000006@catalyst.net.nz>

* 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