10

Is there a way to check PostgreSQL database(s) integrity and consistency? I know about SQL Server DBCC CHECKDB and wonder if there is something similar to PostgreSQL.

FooBar
  • 633
  • 2
  • 6
  • 8
  • 1
    http://pgcheck.projects.postgresql.org/ – Prix Aug 29 '10 at 15:54
  • @Prix, pgCheck has not seen any activity in three years. It doesn't seem like a very good solution. And Arthur ulfeldt (see below) reports no files released ever. – winwaed Feb 02 '11 at 16:41

3 Answers3

2

In 12 version of pgsql, there is pg_checksums.

Reddy Lutonadio
  • 190
  • 1
  • 1
  • 8
Gdfb Cfg
  • 21
  • 2
0

What do you really want to achieve?

The database itself guarantees its integrity. You do not need tools to fiddle with.

cstamas
  • 6,607
  • 24
  • 42
  • 1
    Does the database itself guarantees its integrity when, for example, the server has a bad RAM that crunches bits? – FooBar Aug 29 '10 at 23:43
  • @FooBar: no I think it does not (it can be that some detection mechanism exists). If you have bad RAM the whole operating system will crash sooner or later. This problem should/could be avoided with ECC memory. If you have bad memory you are pretty much out of luck anyways (IMHO). – cstamas Sep 01 '10 at 22:52
  • The question of database integrity is a question I have at the moment. It would explain some problems and it would be nice to be able to cross it off the list of potential causes. It seems that bad memory or disk could lead to db inconsistencies. – winwaed Feb 02 '11 at 16:40
  • I don't think "the database itself guarantees the integrity", is enough. The problem (https://dba.stackexchange.com/questions/275575/data-mismatch-in-view2-select-from-view1-with-view1-how-to-fix) I recently encountered is a good example – Ben Sep 17 '20 at 02:30
0

There exists a tool named pgcheck that checks the integrity of data files:

meshy
  • 105
  • 4
aleroot
  • 3,160
  • 5
  • 28
  • 37