Re: Weird indices

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: Ian Lance Taylor <ian(at)airs(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Weird indices
Date: 2001-02-21 04:46:59
Message-ID: 9239.982730819@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joseph Shraibman <jks(at)selectacast(dot)net> writes:
> Why? There is a mechanism for keeping track of which heap tuples are
> valid, why not index tuples? It is the nature of indices to be updated
> on inserts, why not deletes?

An index is a hint: these tuples *might* be of interest to your
transaction. It's OK for an index to point to some irrelevant tuples,
but it's useless if it fails to point to all the possibly relevant
tuples. Therefore, it's OK to insert an index entry at the earliest
possible instant (as soon as a yet-uncommitted heap tuple is inserted);
and contrariwise the index entry can't be deleted until the heap tuple
can be proven to be no longer of interest to any still-alive transaction.

Currently, proving that a heap tuple is globally no-longer-of-interest
and removing it and its associated index tuples is the task of VACUUM.

Intermediate state transitions (eg, this tuple has been deleted by a
not-yet-committed transaction) are recorded in the heap tuple, but we
don't try to look around and update all the associated index tuples at
the same time. Maintaining that same state in all the index tuples
would be expensive and would bloat the indexes. An index that's not
a lot smaller than the associated heap is of little value, so extra
bits in an index entry are to be feared.

These are very fundamental system design decisions. If you'd like
to show us the error of our ways, step right up to the plate and swing
away; but unsubstantiated suggestions that these choices are wrong are
not going to be taken with any seriousness. Postgres has come pretty
far on the basis of these design choices.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Sawtell 2001-02-21 05:00:13 Bug in my ( newbie ) mind?
Previous Message Romanenko M.A. 2001-02-21 04:39:54 /usr/lib/perl5/5.6/i386-linux/auto/Opcode/Opcode.so doesn't exist.