plpgsql functions and the planner

From: "Matthew Dennis" <mdennis(at)merfer(dot)net>
To: PGSQL <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql functions and the planner
Date: 2008-04-27 06:06:09
Message-ID: e94d85500804262306k877a3b7gc22f05734a05fdeb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Do SQL statements inside of plpgsql functions get planned upon every
execution, only when the function is first executed/defined, or something
else entirely?

For example, suppose I have a table foo and a function bar. Function bar
executes some SQL statements (select/insert/update) against table foo using
various indexed columns. When the function is created and first executed,
table foo is near empty so the statements in function bar use seqscans.
Then table foo is filled with many rows. Now, when bar is executed again,
will PG (8.3.1) know that a seqscan is no longer reasonable?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-04-27 09:09:36 Re: taking actions on rollback (PHP)
Previous Message Scott Marlowe 2008-04-27 02:58:06 Re: taking actions on rollback (PHP)