From: fche@redhat.com
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Mario Splivalo <mario.splivalo@megafon.hr>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query much slower when run from postgres function
Date: Tue, 10 Mar 2009 10:40:51 -0400
Message-ID: <y0mr615785o.fsf@ton.toronto.redhat.com> (raw)
In-Reply-To: <27649.1236616294@sss.pgh.pa.us>
References: <49B51B60.6030600@megafon.hr>
<27649.1236616294@sss.pgh.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: fche@redhat.com, tgl@sss.pgh.pa.us, mario.splivalo@megafon.hr
Subject: Re: Query much slower when run from postgres function
In-Reply-To: <y0mr615785o.fsf@ton.toronto.redhat.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox