Re: Very bad plan when using VIEW and IN (SELECT...*) - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Very bad plan when using VIEW and IN (SELECT...*)
Date
Msg-id 4C65023F020000250003457D@gw.wicourts.gov
Whole thread Raw
In response to Very bad plan when using VIEW and IN (SELECT...*)  ("Carlo Stonebanks" <stonec.register@sympatico.ca>)
Responses Re: Very bad plan when using VIEW and IN (SELECT...*)
List pgsql-performance
"Carlo Stonebanks" <stonec.register@sympatico.ca> wrote:

> SELECT *
> FROM mdx_core.vw_provider AS p
> WHERE provider_id IN (SELECT 13083101)
>
> I am using the simple IN (SELECT n) in QUERY 2 to simplify the
> problem. I noticed the oddity of the behaviour when I used a
> proper "IN (SELECT myId FROM myTable)"

Did you try?:

SELECT *
FROM mdx_core.vw_provider AS p
WHERE EXISTS (SELECT * FROM myTable WHERE myId = provider_id)

For any follow-up you should probably mention what version of
PostgreSQL this is and how it's configured.

http://wiki.postgresql.org/wiki/SlowQueryQuestions

-Kevin

pgsql-performance by date:

Previous
From: Michael March
Date:
Subject: Re: Completely un-tuned Postgresql benchmark results: SSD vs desktop HDD
Next
From: "Carlo Stonebanks"
Date:
Subject: Re: Very bad plan when using VIEW and IN (SELECT...*)