Re: [PATCHES] Index creation takes for ever - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [PATCHES] Index creation takes for ever
Date
Msg-id 200309071616.h87GGNa09222@candle.pha.pa.us
Whole thread Raw
In response to Re: Index creation takes for ever  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCHES] Index creation takes for ever
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I assume this completes this TODO:
> >     * Order duplicate index entries by tid for faster heap lookups
>
> I don't know why that TODO entry exists, but I think the idea is
> counterproductive.  The existing btree code will tend to put newer
> versions of a row earlier (because it puts a new entry in front of any
> with duplicate keys), which usually reduces the time spent skipping dead
> rows.  Forcing tid ordering will cost us more in dead-row skipping than
> it's likely to save elsewhere.

I assume you are talking about a unique index that probably only has a
few non-expired rows (in which case the newer rows first is better).
The TODO deals with cases where you have lots of valid duplicate index
rows, and you want to spin through all the matching rows in heap order
rather than randomly.  This is related to our CLUSTER capability.  The
idea originally came from Vadim.

At what point does this patch do the sorting?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Index creation takes for ever
Next
From: Andreas Pflug
Date:
Subject: Re: pg_id and pg_encoding