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

Re: [PERFORM] temporary indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] temporary indexes
Date: 2006-02-28 17:05:48
Message-ID: 16076.1141146348@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-performance
"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> FWIW, Sybase supported something similar a long time ago. It had the
> ability to build a temporary 'clustered table' (think index organized
> table)  when there was enough benefit to do so. This is actually
> much easier to make happen inside a transaction for us, because we don't
> need to keep visibility information around. There's probably also some
> index metadata that could be done away with. Perhaps the materialize
> node could be made to allow this.

How does what you describe differ from a merge join?  Or a hash join,
if you imagine the temp index as being a hash rather than btree index?

The issue at hand really has nothing to do with temp indexes, it's with
the constrained way that the planner deals with EXISTS subplans.  The
subplans themselves are cheap enough, even in the poorly-indexed
variant, that the planner would certainly never have decided to create
an index to use for them.  The problem only becomes apparent at the next
level up, where those subplans are going to be repeated a huge number of
times ---- but the subplan plan is already chosen and won't be changed.
So even if we invented a temp-index facility, it would fail to be
applied in Kevin's example.  The limiting factor is that EXISTS subplans
aren't flattened ... and once that's fixed, I doubt the example would
need any new kind of join support.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Jim C. NasbyDate: 2006-02-28 17:23:34
Subject: Re: fsync and battery-backed caches
Previous:From: Tom LaneDate: 2006-02-28 16:52:11
Subject: Re: [PERFORM] temporary indexes

pgsql-hackers by date

Next:From: Tom LaneDate: 2006-02-28 17:09:18
Subject: Re: Dead Space Map
Previous:From: Bruce MomjianDate: 2006-02-28 16:58:44
Subject: Re: Dead Space Map

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