Re: Join vs Subquery

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Brian Herlihy" <btherl(at)yahoo(dot)com(dot)au>
Cc: "Postgresql Performance" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Join vs Subquery
Date: 2007-05-03 11:46:31
Message-ID: 874pmu2kq0.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Brian Herlihy" <btherl(at)yahoo(dot)com(dot)au> writes:

> There is a unique index mapping domains to domain_ids.
...
> The issue: the second query results in a lower cost estimate. I am wondering
> why the second query plan was not chosen for the first query.

Well the unique index you mentioned is critical to being able to conclude the
queries are equivalent. Postgres in the past hasn't been able to use things
like unique indexes to make planning decisions because it had no
infrastructure to replan if you dropped the index. We do have such
infrastructure now so it may be possible to add features like this in the
future.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-05-03 14:23:42 Re: Join vs Subquery
Previous Message Ron 2007-05-03 09:18:27 Re: Intermitent slow queries