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?