pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bill Moran <wmoran@potentialtech.com>
To: pgsql-performance@postgresql.org
Subject: cacheable stored functions?
Date: Fri, 20 Feb 2004 10:35:32 -0500
Message-ID: <40362944.2060809@potentialtech.com> (raw)

I'm converting a SQL application to PostgreSQL.  The majority of the logic
in this application is in the stored functions in the database.

Somewhere, I saw a reference to "WITH (iscachable)" for stored functions,
looking again, I'm unable to find any reference to this directive.  I have
a single function that is _obviously_ safe to cache using this, and it
generates no errors or problems that I can see.

Now I'm looking at a lot of other functions that, if cached, would speed
up performance considerably.  Yet I'm reluctant to use this directive
since I can't find documentation on it anywhere.

Can anyone say whether this is a supported feature in plpgsql, and is
safe to use?  Is it simply undocumented, or am I just looking in the
wrong place?

(to reduce ambiguity, the manner in which I'm using this is:

CREATE FUNCTION getconstant(VARCHAR)
RETURNS int
AS '
  DECLARE
  BEGIN
	IF $1 = ''phrase'' THEN
		RETURN 1;
	END IF;

	...

  END;
' LANGUAGE 'plpgsql' WITH (iscacheable);


-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com




view thread (5+ messages)  latest in thread

Message-ID: <40362944.2060809@potentialtech.com>
Permalink:  ../40362944.2060809@potentialtech.com/
Also on:    postgresql.org/message-id/40362944.2060809@potentialtech.com

 · 

reply

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: wmoran@potentialtech.com
  Subject: Re: cacheable stored functions?
  In-Reply-To: <40362944.2060809@potentialtech.com>

* 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