Re: Automatic optimization of IN clauses via INNER JOIN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Hamilton <thomashamilton76(at)yahoo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Automatic optimization of IN clauses via INNER JOIN
Date: 2009-12-17 15:32:53
Message-ID: 2106.1261063973@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thomas Hamilton <thomashamilton76(at)yahoo(dot)com> writes:
> Apparently the latest version of MySQL has solved this problem: http://www.xaprb.com/blog/2006/06/28/why-large-in-clauses-are-problematic/
> But I am running PostgreSQL v8.3 and am observing generally that SELECT ... WHERE ... IN (a, b, c, ...) is much slower than SELECT ... INNER JOIN (SELECT a UNION ALLSELECT b UNION ALL SELECT c ...)

> Why doesn't the optimizer automatically transform IN clauses to INNER JOINs in this fashion?

Did you read all the comments on that three-year-old article?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Thomas Hamilton 2009-12-17 15:45:30 Re: Automatic optimization of IN clauses via INNER JOIN
Previous Message Thomas Hamilton 2009-12-17 15:23:48 Automatic optimization of IN clauses via INNER JOIN