When does Postgres cache query plans?

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: When does Postgres cache query plans?
Date: 2012-09-05 20:38:11
Message-ID: CABs1bs1zchcWTRm+OibONH_fddUtT_DP8LWi_tFN0A5k9NSvHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm curious under what circumstances Postgres will cache an execution
plan for a query.

Obviously if you create it with the PREPARE statement, it will be cached..

However, if I just run an ad-hoc query such as:

select * from Foo where X < 5;

A few hundred times, will that be cached? What if I run:

select * from Foo where X < :value;

Can that be cached, or will it always be re-evaluated based on the
value of :value? Thanks!

Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2012-09-05 20:40:19 Re: "Too far out of the mainstream"
Previous Message Scott Marlowe 2012-09-05 20:34:12 Re: max_connections