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

Re: [PERFORM] temporary indexes

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>,<pgsql-performance(at)postgresql(dot)org>
Subject: Re: [PERFORM] temporary indexes
Date: 2006-02-28 17:36:28
Message-ID: 440435BC.EE98.0025.0@wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-performance
>>> On Tue, Feb 28, 2006 at 11:05 am, in message
<16076(dot)1141146348(at)sss(dot)pgh(dot)pa(dot)us>,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote: 
> 
> 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.

Yet when the index exists, the query is optimized well.

> 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.

That depends.  If the planner was able to generate hypothetical index
descriptions which might be useful, and analyze everything based on
those (adding in creation cost, of course) -- why would it not be able
to come up with the plan which it DID use when the index existed.

> 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.

<digression>
I'm all for that.  So far, we've been going after the low-hanging fruit
in our use of PostgreSQL.  When we get to the main applications, we're
going to be dealing with a lot more in the way of EXISTS clauses.  The
product we're moving from usually optimized an IN test the same as the
logically equivalent EXISTS test, and where a difference existed, it
almost always did better with the EXISTS -- so we encouraged application
programmers to use that form.  Also, EXISTS works in situations where
you need to compare on multiple columns, so it is useful in many
situations where EXISTS or MIN/MAX techniques just don't work.
</digression>

If fixing this would allow hash or merge techniques to cover this as
well as the index did, and that is true in a more general sense (not
just for this one example), then temporary indexes would clearly not
have any value.

-Kevin



In response to

Responses

pgsql-performance by date

Next:From: Kevin GrittnerDate: 2006-02-28 17:55:32
Subject: Re: [PERFORM] temporary indexes
Previous:From: Javier SomozaDate: 2006-02-28 17:27:34
Subject: Re: fsync and battery-backed caches

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2006-02-28 17:39:04
Subject: Re: Dead Space Map
Previous:From: Mark WoodwardDate: 2006-02-28 17:36:03
Subject: Re: pg_config, pg_service.conf, postgresql.conf ....

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