Re: Mismatched pg_class.reltuples between table and primary key - Mailing list pgsql-general

From bricklen
Subject Re: Mismatched pg_class.reltuples between table and primary key
Date
Msg-id CAGrpgQ_f6E=Q0vsXvidVZqw3M_G-Um_tmCSYZOLTy0-onR3SgQ@mail.gmail.com
Whole thread Raw
In response to Re: Mismatched pg_class.reltuples between table and primary key  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-general
Hi Alvaro,

Thanks for the link.

On Mon, Dec 2, 2013 at 4:35 PM, Alvaro Herrera <alvherre@2ndquadrant.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

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Mismatched pg_class.reltuples between table and primary key
Next
From: David Johnston
Date:
Subject: Re: Inserting boolean types as an alias?