HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Postgres 9.1.6 Error index contains unexpected zero page at block 0

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
errorpostgresblockunexpectedcontainspageindexzero

Problem

I have setup streaming replication on Postgres 9.1.6 running on a debian server and it's going on fine.

When I try to run a query on the replica DB I get the error below:

ERROR:  index "tbl_cust_id_idx" contains unexpected zero page at block 0
HINT:  Please REINDEX it.


What might be causing this error?

The question is also posted in https://stackoverflow.com/questions/17865135/postgres-9-1-6-error-index-contains-unexpected-zero-page-at-block-0

Solution

I just ran into the same issue on Postgres 8.3.11. Although I could not identify the root cause, the fix was simple enough:

REINDEX INDEX tbl_cust_id_idx;


This page contains hints as to what may have caused the error, although they are vague:


An indicated table index was corrupted (may be a result of recent postgres or system failure, there was a lack of free space on the device, etc).

Ideally it would be helpful if there was something that could be put in place to proactively prevent or correct these errors. On the bright side, this is the first time we have ever seen this problem in several years and across hundreds of machines.

Code Snippets

REINDEX INDEX tbl_cust_id_idx;

Context

StackExchange Database Administrators Q#47007, answer score: 9

Revisions (0)

No revisions yet.