From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mario Splivalo <mario.splivalo@megafon.hr>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query much slower when run from postgres function
Date: Mon, 09 Mar 2009 12:31:34 -0400
Message-ID: <27649.1236616294@sss.pgh.pa.us> (raw)
In-Reply-To: <49B51B60.6030600@megafon.hr>
References: <49B51B60.6030600@megafon.hr>
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, mario.splivalo@megafon.hr, pgsql-performance@postgresql.org
Subject: Re: Query much slower when run from postgres function
In-Reply-To: <27649.1236616294@sss.pgh.pa.us>
References: <49B51B60.6030600@megafon.hr> <27649.1236616294@sss.pgh.pa.us>
* 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