Re: Query much slower when run from postgres function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mario Splivalo <mario(dot)splivalo(at)megafon(dot)hr>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query much slower when run from postgres function
Date: 2009-03-09 16:31:34
Message-ID: 27649.1236616294@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-performance

Mario Splivalo <mario(dot)splivalo(at)megafon(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Guillaume Cottenceau 2009-03-09 16:51:24 Re: [PERFORM] Query much slower when run from postgres function
Previous Message Mario Splivalo 2009-03-09 13:36:32 Query much slower when run from postgres function

Browse pgsql-performance by date

  From Date Subject
Next Message Guillaume Cottenceau 2009-03-09 16:51:24 Re: [PERFORM] Query much slower when run from postgres function
Previous Message Lee Hughes 2009-03-09 14:28:20 DBT Presentation Location?