Re: DIfferent plans for explicit versus implicit join using link table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John D(dot) Burger" <john(at)mitre(dot)org>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: DIfferent plans for explicit versus implicit join using link table
Date: 2007-04-27 02:54:20
Message-ID: 2758.1177642460@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"John D. Burger" <john(at)mitre(dot)org> writes:
> Tom Lane replied:
>> But the alternative is probably even worse: without that
>> allwordrelations has to be joined to w1 and w2 simultaneously, meaning
>> that the unconstrained cartesian product of w1 and w2 has to be formed
>> first.

> Hmm, but wouldn't it at least filter one side per my where clause:
> w1.word = 'dogging'?

Ah, right, it would do that --- but you still then have to join each of
those rows to every row of w2 before you can do the IN check, and each
of those IN checks would be an index probe into allwordrelations, which
is not that cheap. (Or at least 7.4 doesn't think so --- it does not
have any understanding about multiple index probes on the inside of a
nestloop being cheaper than single probes due to caching of the upper
index levels. You really ought to think about getting onto a newer
version; 8.2 is quite a lot smarter than 7.4.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John D. Burger 2007-04-27 03:36:08 Re: Processing a work queue
Previous Message Tom Lane 2007-04-27 02:49:13 Re: Feature Request --- was: PostgreSQL Performance Tuning