function call vs staright query

From: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: function call vs staright query
Date: 2007-03-18 06:50:54
Message-ID: 200703180750.54703.Vincenzo.Romano@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi all.

I'm experiencing a strange behaviour with 8.1.8 (cannot do upgrades to 8.2 at
the moment).

On a 13+ million rows table I can do a query with results back in less than
100 ms. Result is a set of bigint.
But when I encapsulate that query into an "SQL" function with three parameters
the results come back in about one minute. The function contains just the same
query as above.
Of course there's been no change in indices or even into the table itself
between the two tests.

I'm almost sure I'm missing something, but have no clue about what!
Any hint?

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Vincenzo Romano 2007-03-18 07:12:48 Re: function call vs staright query
Previous Message hubert depesz lubaczewski 2007-03-17 04:52:39 Re: Postgres batch write very slow - what to do