From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sabin Coanda <sabin.coanda@deuromedia.ro>
Cc: pgsql-performance@postgresql.org
Subject: Re: low performance on functions returning setof record
Date: Thu, 09 Oct 2008 15:30:51 -0400
Message-ID: <3693.1223580651@sss.pgh.pa.us> (raw)
In-Reply-To: <gcl5hg$2kq8$1@news.hub.org>
References: <gcl5hg$2kq8$1@news.hub.org>
"Sabin Coanda" <sabin.coanda@deuromedia.ro> writes:
> I use different functions returning setof record, and they are working well.
> The problem is the performance when I use those functions in joins, for
> instance:
> SELECT *
> FROM "Table1" t1
> JOIN "Function1"( a1, a2, ... aN ) AS f1( ColA int4, ColB
> varchar, ... )
> ON t1.ColX = f1.ColA
> The problem is I'm not able to make indexes on the function, even inside I
> have just another select statement from different permanent tables, with
> some where clauses depending on the function arguments.
There's not a lot you can do about that at the moment. 8.4 will have
the ability to inline functions returning sets, if they're SQL-language
and consist of just a single SELECT, but existing releases won't do it.
You might consider trying to refactor your stuff to use views ...
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, sabin.coanda@deuromedia.ro
Subject: Re: low performance on functions returning setof record
In-Reply-To: <3693.1223580651@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