Re: functions, selects and the planner

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Matthew Dennis" <mdennis(at)merfer(dot)net>
Cc: PGSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: functions, selects and the planner
Date: 2008-06-15 03:58:05
Message-ID: 5733.1213502285@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Matthew Dennis" <mdennis(at)merfer(dot)net> writes:
> My question is when is the "select into _data" query planned/replanned? I'm
> concerned that the query might only be planned once (e.g. the first time
> it's executed or when the function is first defined) and cached
> indefinitely. The table t is initially empty, but grows at a fairly steady
> rate over time. So if the table is essentially empty when the query is
> planned, a seqscan is certainly what the planner would do. However, as time
> goes on and table t is filled with data and the stats change, will the query
> eventually be replanned?

In 8.3, a replan will occur whenever VACUUM/ANALYZE update
pg_class.reltuples, so I think you don't need to worry --- at least not
unless you've disabled autovacuum and chosen a bad manual vacuuming
strategy.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message D. Dante Lorenso 2008-06-15 05:01:29 Need Tool to sync databases with 8.3.1
Previous Message Matthew Dennis 2008-06-15 03:39:17 functions, selects and the planner