From: | Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: In progress INSERT wrecks plans on table |
Date: | 2013-05-11 04:58:47 |
Message-ID: | 518DD007.4000006@catalyst.net.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
On 11/05/13 01:30, Tom Lane wrote:
> Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2013-05-11 07:45:52 | Re: corrupt pages detected by enabling checksums |
Previous Message | Pavel Stehule | 2013-05-11 04:34:24 | Re: issues with dropped columns in plpgsql code again |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2013-05-11 23:28:32 | Re: Setting vacuum_freeze_min_age really low |
Previous Message | Misa Simic | 2013-05-10 23:12:37 | Re: PostgreSQL planner |