Re: Join vs Subquery - Mailing list pgsql-performance

From Gregory Stark
Subject Re: Join vs Subquery
Date
Msg-id 874pmu2kq0.fsf@oxford.xeocode.com
Whole thread Raw
In response to Join vs Subquery  (Brian Herlihy <btherl@yahoo.com.au>)
List pgsql-performance
"Brian Herlihy" <btherl@yahoo.com.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


pgsql-performance by date:

Previous
From: Ron
Date:
Subject: Re: Intermitent slow queries
Next
From: Tom Lane
Date:
Subject: Re: Join vs Subquery