Re: Minmax indexes

Erik Rijkers <er@xs4all.nl>

From: "Erik Rijkers" <er@xs4all.nl>
To: "Alvaro Herrera" <alvherre@2ndquadrant.com>
Cc: "Jaime Casanova" <jaime@2ndquadrant.com>, "Thom Brown" <thom@linux.com>, "Pg Hackers" <pgsql-hackers@postgresql.org>
Date: 2013-09-25T06:39:55Z
Lists: pgsql-hackers
On Wed, September 25, 2013 00:14, Alvaro Herrera wrote:
> [minmax-4-incr.patch]

After a  --data-checksums initdb (successful), the following error came up:



after the statement: create index t_minmax_idx on t using minmax (r);

WARNING:  page verification failed, calculated checksum 25951 but expected 0
ERROR:  invalid page in block 1 of relation base/21324/26267_vm

it happens reliably. every time I run the program.

Below is the whole program that I used.


Thanks,

Erik Rijkers






#!/bin/sh

t=t

if [[ 1 -eq 1 ]]; then

    echo "
        drop table if exists $t ;
        create table $t
            as
            select i, cast( random() * 10^9 as integer ) as r
            from generate_series(1, 1000000)  as f(i) ;
    analyze $t;
    table $t limit 5;
    select count(*) from $t;
    explain analyze select min(r), max(r) from $t;
                            select min(r), max(r) from $t;

    create index ${t}_minmax_idx on $t using minmax (r);
    analyze $t;

    explain analyze select min(r), max(r) from $t;
                            select min(r), max(r) from $t;

    " | psql

fi





Commits

  1. Refactor per-page logic common to all redo routines to a new function.

  2. Reduce use of heavyweight locking inside hash AM.

  3. Scan the buffer pool just once, not once per fork, during relation drop.

  4. Major patch from Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>