Re: Query much slower when run from postgres function - Mailing list pgsql-performance

From Tom Lane
Subject Re: Query much slower when run from postgres function
Date
Msg-id 27649.1236616294@sss.pgh.pa.us
Whole thread Raw
In response to Query much slower when run from postgres function  (Mario Splivalo <mario.splivalo@megafon.hr>)
Responses Re: Query much slower when run from postgres function  (Guillaume Cottenceau <gc@mnc.ch>)
Re: Query much slower when run from postgres function  (Mario Splivalo <mario.splivalo@megafon.hr>)
Re: Query much slower when run from postgres function  (fche@redhat.com (Frank Ch. Eigler))
List pgsql-performance
Mario Splivalo <mario.splivalo@megafon.hr> writes:
> Now I'm confused, why is 'sql' function much slower than 'direct' SELECT?

Usually the reason for this is that the planner chooses a different plan
when it has knowledge of the particular value you are searching for than
when it does not.  I suppose 'service_id' has a very skewed distribution
and you are looking for an uncommon value?

            regards, tom lane

pgsql-performance by date:

Previous
From: Lee Hughes
Date:
Subject: DBT Presentation Location?
Next
From: Guillaume Cottenceau
Date:
Subject: Re: Query much slower when run from postgres function