Re: Mismatched pg_class.reltuples between table and primary key

From: bricklen <bricklen(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Mismatched pg_class.reltuples between table and primary key
Date: 2013-12-03 01:00:34
Message-ID: CAGrpgQ_f6E=Q0vsXvidVZqw3M_G-Um_tmCSYZOLTy0-onR3SgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Alvaro,

Thanks for the link.

On Mon, Dec 2, 2013 at 4:35 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>wrote:

> bricklen escribió:
> > We recently experienced a hard crash of a dev server due to lack of
> > resources (we think, still investigating).
> > That resulted in an interesting scenario where one of the tables was
> > returning 12 rows from "select * from tbl", but "select * from tbl order
> by
> > <pk column>" was only returning 11.
> > Looking at pg_class.reltuples, it could be clearly seen that the table in
> > question had a value of 12, but the primary key had only 11.
>
> This sounds very similar to what was reported in
>
> http://www.postgresql.org/message-id/20131126123244.GI23284@alap2.anarazel.de
>
> In short, you probably want to make sure to upgrade to this week's
> release.
>

If it is indeed the same issue (and I see something similar in an actual
production system running 9.2.5 which was recovered from a crashed LVM just
the other day), are the chances of data corruption particularly high? From
reading over that linked thread, it looked like the problem was likely to
stem from wraparound.

Once the patch is applied, will the existing data still be vulnerable? I
haven't been paying close attention to that particular thread, so I might
have missed a few things regarding the fixes -- will a full dump + reload
be necessary?

Thanks,

Bricklen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2013-12-03 01:18:57 Re: Inserting boolean types as an alias?
Previous Message Alvaro Herrera 2013-12-03 00:35:12 Re: Mismatched pg_class.reltuples between table and primary key