pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
15+ messages / 8 participants
[nested] [flat]
* pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
@ 2017-03-16 22:39 Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-16 22:44 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Vik Fearing <vik.fearing@2ndquadrant.com>
2017-03-17 03:37 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 15+ messages in thread
From: Andrew Gierth @ 2017-03-16 22:39 UTC (permalink / raw)
To: pgsql-committers
Avoid having vacuum set reltuples to 0 on non-empty relations in the
presence of page pins, which leads to serious estimation errors in the
planner. This particularly affects small heavily-accessed tables,
especially where locking (e.g. from FK constraints) forces frequent
vacuums for mxid cleanup.
Fix by keeping separate track of pages whose live tuples were actually
counted vs. pages that were only scanned for freezing purposes. Thus,
reltuples can only be set to 0 if all pages of the relation were
actually counted.
Backpatch to all supported versions.
Per bug #14057 from Nicolas Baccelli, analyzed by me.
Discussion: https://postgr.es/m/20160331103739.8956.94469@wrigleys.postgresql.org
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/1914c5ea7daaaaba4420f65c991256af5d4a9813
Modified Files
--------------
src/backend/commands/vacuumlazy.c | 15 ++++--
src/test/isolation/expected/vacuum-reltuples.out | 62 ++++++++++++++++++++++++
src/test/isolation/isolation_schedule | 1 +
src/test/isolation/specs/vacuum-reltuples.spec | 45 +++++++++++++++++
4 files changed, 119 insertions(+), 4 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
@ 2017-03-16 22:44 ` Vik Fearing <vik.fearing@2ndquadrant.com>
1 sibling, 0 replies; 15+ messages in thread
From: Vik Fearing @ 2017-03-16 22:44 UTC (permalink / raw)
To: Andrew Gierth <rhodiumtoad@postgresql.org>; +Cc: pgsql-committers
On Thu, Mar 16, 2017 at 11:39 PM, Andrew Gierth <rhodiumtoad@postgresql.org>
wrote:
> Avoid having vacuum set reltuples to 0 on non-empty relations in the
> presence of page pins, which leads to serious estimation errors in the
> planner. This particularly affects small heavily-accessed tables,
> especially where locking (e.g. from FK constraints) forces frequent
> vacuums for mxid cleanup.
>
> Fix by keeping separate track of pages whose live tuples were actually
> counted vs. pages that were only scanned for freezing purposes. Thus,
> reltuples can only be set to 0 if all pages of the relation were
> actually counted.
>
> Backpatch to all supported versions.
>
> Per bug #14057 from Nicolas Baccelli, analyzed by me.
>
> Discussion: https://postgr.es/m/20160331103739.8956.94469@
> wrigleys.postgresql.org
>
Congrats on your first commit!
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
@ 2017-03-17 03:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-17 03:44 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andres Freund <andres@anarazel.de>
2017-03-17 12:21 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <andrew@tao11.riddles.org.uk>
1 sibling, 2 replies; 15+ messages in thread
From: Tom Lane @ 2017-03-17 03:37 UTC (permalink / raw)
To: Andrew Gierth <rhodiumtoad@postgresql.org>; +Cc: pgsql-committers
Andrew Gierth <rhodiumtoad@postgresql.org> writes:
> Avoid having vacuum set reltuples to 0 on non-empty relations in the
> presence of page pins, which leads to serious estimation errors in the
> planner.
Hm, buildfarm results suggest this test is not entirely stable:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2017-03-17%2000%3A47%3A57
I have not looked very closely, but I'm suspicious that the test case
depends on no autovacuum transactions running concurrently with it.
Disabling autovac on the table itself is not enough to control whether
global xmin is being held back by some other autovac transaction
somewhere.
regards, tom lane
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 03:37 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-03-17 03:44 ` Andres Freund <andres@anarazel.de>
1 sibling, 0 replies; 15+ messages in thread
From: Andres Freund @ 2017-03-17 03:44 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Gierth <rhodiumtoad@postgresql.org>; pgsql-committers
On 2017-03-16 23:37:06 -0400, Tom Lane wrote:
> Andrew Gierth <rhodiumtoad@postgresql.org> writes:
> > Avoid having vacuum set reltuples to 0 on non-empty relations in the
> > presence of page pins, which leads to serious estimation errors in the
> > planner.
>
> Hm, buildfarm results suggest this test is not entirely stable:
>
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2017-03-17%2000%3A47%3A57
>
> I have not looked very closely, but I'm suspicious that the test case
> depends on no autovacuum transactions running concurrently with it.
> Disabling autovac on the table itself is not enough to control whether
> global xmin is being held back by some other autovac transaction
> somewhere.
Yea, brought it up on IRC too - he's gone for the night (Europe). I
suspect changing things > might do the trick.
- Andres
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 03:37 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-03-17 12:21 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2017-03-17 13:18 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <andrew@tao11.riddles.org.uk>
1 sibling, 1 reply; 15+ messages in thread
From: Andrew Gierth @ 2017-03-17 12:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Gierth <rhodiumtoad@postgresql.org>; pgsql-committers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> Hm, buildfarm results suggest this test is not entirely stable:
I see it and will work on it.
Tom> I have not looked very closely, but I'm suspicious that the test
Tom> case depends on no autovacuum transactions running concurrently
Tom> with it. Disabling autovac on the table itself is not enough to
Tom> control whether global xmin is being held back by some other
Tom> autovac transaction somewhere.
Aren't vacuum transactions ignored for that? vacuum_set_xid_limits is
certainly passing ignoreVacuum=true to GetOldestXmin.
--
Andrew.
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 03:37 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Tom Lane <tgl@sss.pgh.pa.us>
2017-03-17 12:21 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <andrew@tao11.riddles.org.uk>
@ 2017-03-17 13:18 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Gierth @ 2017-03-17 13:18 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Gierth <rhodiumtoad@postgresql.org>; pgsql-committers
>>>>> "Andrew" == Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
Tom> I have not looked very closely, but I'm suspicious that the test
Tom> case depends on no autovacuum transactions running concurrently
Tom> with it. Disabling autovac on the table itself is not enough to
Tom> control whether global xmin is being held back by some other
Tom> autovac transaction somewhere.
Andrew> Aren't vacuum transactions ignored for that?
Andrew> vacuum_set_xid_limits is certainly passing ignoreVacuum=true to
Andrew> GetOldestXmin.
Answering my own question: vacuum transactions are ignored but analyze
transactions aren't, and autovacuum will happily kick off an autoanalyze
of pg_attribute during the test.
Simplest fix seems to just be to remove the delete statement; I've
verified that the problem can be reproduced without it, and that should
make the result independent of OldestXmin. I'll commit that shortly
unless I hear to the contrary.
--
Andrew.
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
@ 2017-03-16 22:39 Andrew Gierth <rhodiumtoad@postgresql.org>
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Gierth @ 2017-03-16 22:39 UTC (permalink / raw)
To: pgsql-committers
Avoid having vacuum set reltuples to 0 on non-empty relations in the
presence of page pins, which leads to serious estimation errors in the
planner. This particularly affects small heavily-accessed tables,
especially where locking (e.g. from FK constraints) forces frequent
vacuums for mxid cleanup.
Fix by keeping separate track of pages whose live tuples were actually
counted vs. pages that were only scanned for freezing purposes. Thus,
reltuples can only be set to 0 if all pages of the relation were
actually counted.
Backpatch to all supported versions.
Per bug #14057 from Nicolas Baccelli, analyzed by me.
Discussion: https://postgr.es/m/20160331103739.8956.94469@wrigleys.postgresql.org
Branch
------
REL9_6_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/9b626f6c334f95f1052b22b13d9ddbcc4de5fc4f
Modified Files
--------------
src/backend/commands/vacuumlazy.c | 15 ++++--
src/test/isolation/expected/vacuum-reltuples.out | 62 ++++++++++++++++++++++++
src/test/isolation/isolation_schedule | 1 +
src/test/isolation/specs/vacuum-reltuples.spec | 45 +++++++++++++++++
4 files changed, 119 insertions(+), 4 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
@ 2017-03-16 22:39 Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 13:30 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Gierth @ 2017-03-16 22:39 UTC (permalink / raw)
To: pgsql-committers
Avoid having vacuum set reltuples to 0 on non-empty relations in the
presence of page pins, which leads to serious estimation errors in the
planner. This particularly affects small heavily-accessed tables,
especially where locking (e.g. from FK constraints) forces frequent
vacuums for mxid cleanup.
Fix by keeping separate track of pages whose live tuples were actually
counted vs. pages that were only scanned for freezing purposes. Thus,
reltuples can only be set to 0 if all pages of the relation were
actually counted.
Backpatch to all supported versions.
Per bug #14057 from Nicolas Baccelli, analyzed by me.
Discussion: https://postgr.es/m/20160331103739.8956.94469@wrigleys.postgresql.org
Branch
------
REL9_5_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/ee78ad5bc0d2b905fdfcee997c76e98292f65fbb
Modified Files
--------------
src/backend/commands/vacuumlazy.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
@ 2017-03-17 13:30 ` Robert Haas <robertmhaas@gmail.com>
2017-03-17 13:54 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
0 siblings, 1 reply; 15+ messages in thread
From: Robert Haas @ 2017-03-17 13:30 UTC (permalink / raw)
To: Andrew Gierth <rhodiumtoad@postgresql.org>; +Cc: pgsql-committers
On Thu, Mar 16, 2017 at 6:39 PM, Andrew Gierth
<rhodiumtoad@postgresql.org> wrote:
> Avoid having vacuum set reltuples to 0 on non-empty relations in the
> presence of page pins, which leads to serious estimation errors in the
> planner. This particularly affects small heavily-accessed tables,
> especially where locking (e.g. from FK constraints) forces frequent
> vacuums for mxid cleanup.
>
> Fix by keeping separate track of pages whose live tuples were actually
> counted vs. pages that were only scanned for freezing purposes. Thus,
> reltuples can only be set to 0 if all pages of the relation were
> actually counted.
>
> Backpatch to all supported versions.
>
> Per bug #14057 from Nicolas Baccelli, analyzed by me.
>
> Discussion: https://postgr.es/m/20160331103739.8956.94469@wrigleys.postgresql.org
In the department of nitpicks, we usually try to write commit messages
so that the first line is a summary line which stands alone, and then
there's a blank line, and then more follows. a la
https://chris.beams.io/posts/git-commit/#separate
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 13:30 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Robert Haas <robertmhaas@gmail.com>
@ 2017-03-17 13:54 ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-03-17 14:00 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Dunstan @ 2017-03-17 13:54 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; Andrew Gierth <rhodiumtoad@postgresql.org>; +Cc: pgsql-committers
On 03/17/2017 09:30 AM, Robert Haas wrote:
>
> In the department of nitpicks, we usually try to write commit messages
> so that the first line is a summary line which stands alone, and then
> there's a blank line, and then more follows. a la
> https://chris.beams.io/posts/git-commit/#separate
>
Yeah, In our case email subjects seem to be truncated at 64 chars, so
it's best to stay under that limit if possible - 50 chars is sometimes
pretty limiting.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 13:30 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Robert Haas <robertmhaas@gmail.com>
2017-03-17 13:54 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2017-03-17 14:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-18 19:19 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 15+ messages in thread
From: Tom Lane @ 2017-03-17 14:00 UTC (permalink / raw)
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Andrew Gierth <rhodiumtoad@postgresql.org>; pgsql-committers
Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> On 03/17/2017 09:30 AM, Robert Haas wrote:
>> In the department of nitpicks, we usually try to write commit messages
>> so that the first line is a summary line which stands alone, and then
>> there's a blank line, and then more follows. a la
>> https://chris.beams.io/posts/git-commit/#separate
> Yeah, In our case email subjects seem to be truncated at 64 chars, so
> it's best to stay under that limit if possible - 50 chars is sometimes
> pretty limiting.
FWIW, I usually try to keep line length in commit messages to <= 75
characters, as that is the wrap boundary in "git log" output. It's
nice if the summary line can be made shorter, but it's often damn
hard to cram an adequate summary into 75 chars, let alone fewer.
(Links to mailing-list threads must ignore the length limit, sadly.)
regards, tom lane
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 13:30 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Robert Haas <robertmhaas@gmail.com>
2017-03-17 13:54 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-03-17 14:00 ` Re: pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-03-18 19:19 ` Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 15+ messages in thread
From: Bruce Momjian @ 2017-03-18 19:19 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Andrew Gierth <rhodiumtoad@postgresql.org>; pgsql-committers
On Fri, Mar 17, 2017 at 10:00:17AM -0400, Tom Lane wrote:
> Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> > On 03/17/2017 09:30 AM, Robert Haas wrote:
> >> In the department of nitpicks, we usually try to write commit messages
> >> so that the first line is a summary line which stands alone, and then
> >> there's a blank line, and then more follows. a la
> >> https://chris.beams.io/posts/git-commit/#separate
>
> > Yeah, In our case email subjects seem to be truncated at 64 chars, so
> > it's best to stay under that limit if possible - 50 chars is sometimes
> > pretty limiting.
>
> FWIW, I usually try to keep line length in commit messages to <= 75
> characters, as that is the wrap boundary in "git log" output. It's
> nice if the summary line can be made shorter, but it's often damn
> hard to cram an adequate summary into 75 chars, let alone fewer.
>
> (Links to mailing-list threads must ignore the length limit, sadly.)
Here are the length limits I have found, and I display this in my email
editor when I am creating a commit message:
-- email subject limit -----------------------------------------
-- gitweb summary limit --------------------------
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
@ 2017-03-16 22:39 Andrew Gierth <rhodiumtoad@postgresql.org>
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Gierth @ 2017-03-16 22:39 UTC (permalink / raw)
To: pgsql-committers
Avoid having vacuum set reltuples to 0 on non-empty relations in the
presence of page pins, which leads to serious estimation errors in the
planner. This particularly affects small heavily-accessed tables,
especially where locking (e.g. from FK constraints) forces frequent
vacuums for mxid cleanup.
Fix by keeping separate track of pages whose live tuples were actually
counted vs. pages that were only scanned for freezing purposes. Thus,
reltuples can only be set to 0 if all pages of the relation were
actually counted.
Backpatch to all supported versions.
Per bug #14057 from Nicolas Baccelli, analyzed by me.
Discussion: https://postgr.es/m/20160331103739.8956.94469@wrigleys.postgresql.org
Branch
------
REL9_4_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/269efd052922489cf91fd0bc5a80c2008f553b49
Modified Files
--------------
src/backend/commands/vacuumlazy.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
@ 2017-03-16 22:39 Andrew Gierth <rhodiumtoad@postgresql.org>
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Gierth @ 2017-03-16 22:39 UTC (permalink / raw)
To: pgsql-committers
Avoid having vacuum set reltuples to 0 on non-empty relations in the
presence of page pins, which leads to serious estimation errors in the
planner. This particularly affects small heavily-accessed tables,
especially where locking (e.g. from FK constraints) forces frequent
vacuums for mxid cleanup.
Fix by keeping separate track of pages whose live tuples were actually
counted vs. pages that were only scanned for freezing purposes. Thus,
reltuples can only be set to 0 if all pages of the relation were
actually counted.
Backpatch to all supported versions.
Per bug #14057 from Nicolas Baccelli, analyzed by me.
Discussion: https://postgr.es/m/20160331103739.8956.94469@wrigleys.postgresql.org
Branch
------
REL9_3_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/8f8a5aefc73524658f989f3abd929afa5e7d3ff7
Modified Files
--------------
src/backend/commands/vacuumlazy.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
* pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in
@ 2017-03-16 22:39 Andrew Gierth <rhodiumtoad@postgresql.org>
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Gierth @ 2017-03-16 22:39 UTC (permalink / raw)
To: pgsql-committers
Avoid having vacuum set reltuples to 0 on non-empty relations in the
presence of page pins, which leads to serious estimation errors in the
planner. This particularly affects small heavily-accessed tables,
especially where locking (e.g. from FK constraints) forces frequent
vacuums for mxid cleanup.
Fix by keeping separate track of pages whose live tuples were actually
counted vs. pages that were only scanned for freezing purposes. Thus,
reltuples can only be set to 0 if all pages of the relation were
actually counted.
Backpatch to all supported versions.
Per bug #14057 from Nicolas Baccelli, analyzed by me.
Discussion: https://postgr.es/m/20160331103739.8956.94469@wrigleys.postgresql.org
Branch
------
REL9_2_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/a494ff4b012b5ce89b2549d5dab6b66604083bf0
Modified Files
--------------
src/backend/commands/vacuumlazy.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 15+ messages in thread
end of thread, other threads:[~2017-03-18 19:19 UTC | newest]
Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-16 22:44 ` Vik Fearing <vik.fearing@2ndquadrant.com>
2017-03-17 03:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-17 03:44 ` Andres Freund <andres@anarazel.de>
2017-03-17 12:21 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2017-03-17 13:18 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-17 13:30 ` Robert Haas <robertmhaas@gmail.com>
2017-03-17 13:54 ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2017-03-17 14:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-18 19:19 ` Bruce Momjian <bruce@momjian.us>
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
2017-03-16 22:39 pgsql: Avoid having vacuum set reltuples to 0 on non-empty relations in Andrew Gierth <rhodiumtoad@postgresql.org>
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