Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group