pl-pgsql "return set of..." "return next..." performance question

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: pl-pgsql "return set of..." "return next..." performance question
Date: 2007-11-16 18:03:27
Message-ID: D7FF158337303A419CF4A183F48302D6035A2EE2@hdsmsx411.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi:

I have PL-PgSQL function that returns a set of records. It builds up 2
temp tables and then queries them to generate the set of records to be
returned a-la....

for rrec in

select t1.x, t2.x from t1, t2 where....

loop

return next rrec;

end loop;

I noticed that it takes a long time to return the set of records. But
if I run the same query at the psql cli, it runs blindingly fast. So it
appears that the process of returning the records via "return next" is
the performance culprit.

Any ideas?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2007-11-16 18:15:38 Re: pl-pgsql "return set of..." "return next..." performance question
Previous Message xeb 2007-11-16 17:59:25 ERROR: invalid restriction selectivity: 224359728.000000