Re: Very bad plan when using VIEW and IN (SELECT...*)

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-performance(at)postgresql(dot)org>, "Carlo Stonebanks" <stonec(dot)register(at)sympatico(dot)ca>
Subject: Re: Very bad plan when using VIEW and IN (SELECT...*)
Date: 2010-08-13 13:28:47
Message-ID: 4C65023F020000250003457D@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Carlo Stonebanks" <stonec(dot)register(at)sympatico(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Carlo Stonebanks 2010-08-13 14:51:00 Re: Very bad plan when using VIEW and IN (SELECT...*)
Previous Message Michael March 2010-08-13 06:06:59 Re: Completely un-tuned Postgresql benchmark results: SSD vs desktop HDD