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

From fche@redhat.com (Frank Ch. Eigler)
Subject Re: Query much slower when run from postgres function
Date
Msg-id y0mr615785o.fsf@ton.toronto.redhat.com
Whole thread Raw
In response to Re: Query much slower when run from postgres function  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Query much slower when run from postgres function
List pgsql-performance
Tom Lane <tgl@sss.pgh.pa.us> writes:

> 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?

For a prepared statement, could the planner produce *several* plans,
if it guesses great sensitivity to the parameter values?  Then it
could choose amongst them at run time.

- FChE

pgsql-performance by date:

Previous
From: Matthew Wakeling
Date:
Subject: Re: When does sequential performance matter in PG?
Next
From: henk de wit
Date:
Subject: Re: When does sequential performance matter in PG?