Re: Plan invalidation design

From: Lukas Kahwe Smith <smith(at)pooteeweet(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Plan invalidation design
Date: 2007-02-18 02:02:46
Message-ID: 45D7B3C6.8050403@pooteeweet.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

> Relcache inval casts a fairly wide net; for example, adding or dropping an
> index will invalidate all plans using the index's table whether or not
> they used that particular index, and I believe that VACUUM will also
> result in a relcache inval due to updating the table's pg_class row.
> I think this is a good thing though --- for instance, after adding an
> index it seems a good idea to replan to see if the new index is useful,
> and replanning after a VACUUM is useful if the table has changed size
> enough to warrant a different plan. OTOH this might mean that plans on a
> high-update-traffic table never survive very long because of autovacuum's
> efforts. If that proves to be a problem in practice we can look at ways
> to dial down the number of replans, but for the moment I think it's more
> important to be sure we *can* replan at need than to find ways to avoid
> replans.

I remember that there was discussion about invalidating plans who's
estimated cost turn out to be severely off when executed. That is
probably a more reliable metric (than invalidating with every VACCUM -
unless of course the amount of changed rows is considered), though it
will probably put a fixed overhead on all relevant queries. So it might
not be feasible. Of course this checking after a query runs longer than
expected also means that at least one execution will in fact have to run
slow instead of preempting this from happening at all.

Also while not directly related it might be thing to keep in mind. It
would also be cool to support multiple plans for different sets of
parameters, since obviously the data distribution and therefore the
optimal plan will potentially vary greatly with different parameters.

regards,
Lukas

PS: I moved "Plan invalidation" to confirmed on the wishlist ..

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-02-18 02:03:27 Short varlena header bit-packing options
Previous Message Bruce Momjian 2007-02-18 02:02:33 Re: Chatter on DROP SOMETHING IF EXISTS