From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Fwd: Calling functions inside a function: behavior |
Date: | 2001-04-02 17:20:13 |
Message-ID: | web-32642@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Edipo,
> FUNCTION (...) AS '(...)BEGIN
> PERFORM FUNCTION1();
> PERFORM FUNCTION2();
> (...)
> END;' LANGUAGE 'PLPGSQL';
I'm not sure about that syntax (PERFORM). I ususally set my functions
equal to a value ('remote_result := Function1(paramater)'). This has
the added advantage of letting me use an exit value from my sensted
function to communicate with the parent function ('IF remote_result =
'ERROR' THEN ... '). I'm just not sure what bugaboos you may be running
into with PERFORM.
One possibility (Tom, Jan, verify me on this): All calls in a function
are automatically nested in a transaction. Thus, if FunctionM calls
Function1, 2, and 3, then the system should reverse Functions 1, 2, and
3 if M errors out at any point. This means that all of the changes made
by the nested calls need to be cached somehow; on a slow or low-memory
system, this could lead to bogging down as your machine utilizes its
swap space if Functions 1, 2, and 3 involve heavy data interactions.
One way to test this, is to modify your test script as follows:
BEGIN WORK;
PERFORM Function1;
SELECT current_timestamp;
PERFORM Function2;
SELECT current_timestamp;
etc ...
COMMIT WORK;
If the test script bogs down as well, you have your answer although the
workaround may be tricky to implement.
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Lamar Owen | 2001-04-02 17:20:43 | Re: Re: Indexes vs indices |
Previous Message | Bruce Momjian | 2001-04-02 16:58:52 | Re: Indexes vs indices |