Skip site navigation (1) Skip section navigation (2)

Re: I/O on select count(*)

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Matthew Wakeling" <matthew(at)flymine(dot)org>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: I/O on select count(*)
Date: 2008-05-15 12:52:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Matthew Wakeling wrote:
> Is it really safe to update the hint bits in place? If there is a power 
> cut in the middle of writing a block, is there a guarantee from the disc 
> that the block will never be garbled?

Don't know, to be honest. We've never seen any reports of corrupted data 
that would suggest such a problem, but it doesn't seem impossible to me 
that some exotic storage system might do that.

> Is there a way to make a shortcut and have the hint bits written the 
> first time the data is written to the table? One piece of obvious 
> low-hanging fruit would be to enhance step five above, so that the 
> bgwriter or checkpoint that writes the data to the database table checks 
> the pg_clog and writes the correct hint bits.

Yep, that's an idea that's been suggested before. In fact, I seem to 
remember a patch to do just that. Don't remember what happened to it,

> In fact, if the tuple's 
> creating transaction has aborted, then the tuple can be vacuumed right 
> there and then before it is even written. 

Not if you have any indexes on the table. To vacuum, you'll have to scan 
all indexes to remove pointers to the tuple.

> However, this idea does not deal well with bulk data loads, where the 
> data is checkpointed before transaction is committed or aborted.

Yep, that's the killer :-(.

   Heikki Linnakangas

In response to


pgsql-performance by date

Next:From: Matthew WakelingDate: 2008-05-15 12:54:13
Subject: Re: I/O on select count(*)
Previous:From: Matthew WakelingDate: 2008-05-15 12:37:34
Subject: Re: I/O on select count(*)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group