Re: plpgsql plan cache

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joel Jacobson <joel(at)gluefinance(dot)com>
Cc: "Pierre C" <lists(at)peufeu(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: plpgsql plan cache
Date: 2010-02-22 21:20:58
Message-ID: 1801.1266873658@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Joel Jacobson <joel(at)gluefinance(dot)com> writes:
> Hm, it is strange the query planner is using two different strategies
> for the same query?

They're not the same query. One plan is generic for any value of the
parameters, the other is chosen for specific values of those parameters.
In particular, the unparameterized query depends very strongly on the
knowledge that not many rows will meet the RecordDate range constraint.
If you picked dates that were further apart you'd probably get something
that looked more like the other plan.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Nikolas Everett 2010-02-22 21:23:56 Re: plpgsql plan cache
Previous Message Joel Jacobson 2010-02-22 19:58:10 Re: plpgsql plan cache