Re: index usage in joins q'n

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: rihad <rihad(at)mail(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index usage in joins q'n
Date: 2007-11-03 08:49:19
Message-ID: 20071103084919.GA9036@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Nov 03, 2007 at 11:42:39AM +0400, rihad wrote:
> Does this mean that a condition like "WHERE ... [AND] lhs.a=rhs.b [AND]
> ..." where rhs.b is already unique-indexed, also requires (non-unique)
> index on lhs.a for maximal join speed? Otherwise why would they want to
> say that?

No, as long as one of the two columns is indexed it can help. An index
on both might help if you need a lot of rows but it's a bit hard to
construct a situation where it'd be obvious.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shane Ambler 2007-11-03 10:10:15 Re: Populating large DB from Perl script
Previous Message rihad 2007-11-03 07:42:39 index usage in joins q'n