From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Rod Taylor <rbt@rbt.ca>
Cc: ow <oneway_111@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: 7.4 - FK constraint performance
Date: Fri, 13 Feb 2004 07:02:51 -0800 (PST)
Message-ID: <20040213065530.M19832@megazone.bigpanda.com> (raw)
In-Reply-To: <27443.1076646336@sss.pgh.pa.us>
References: <20040213010341.95282.qmail@web60801.mail.yahoo.com>
<25808.1076634636@sss.pgh.pa.us>
<1076640825.10896.12.camel@jester>
<27443.1076646336@sss.pgh.pa.us>
On Thu, 12 Feb 2004, Tom Lane wrote:
> Rod Taylor <rbt@rbt.ca> writes:
> > Statistics say there are 10 values. Statistics list the 10 most common
> > values (all of them). Given this, would it not be reasonable to assume
> > that 239 is a recent addition (if there at all) to the table and not
> > very common?
>
> We don't know that it's 239 when we make the plan. In order to know
> that, we'd have to abandon caching of RI check query plans and re-plan
> for each row. That strikes me as inevitably a losing proposition.
One thing is that IIRC we're going to ask for only one row when we do the
SPI_execp_current. However, unless I misremember, the behavior of for
update and limit means that saying limit 1 is potentially unsafe (if you
block on a row that goes away). Is there anyway for us to let the planner
know this?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, tgl@sss.pgh.pa.us, rbt@rbt.ca, oneway_111@yahoo.com
Subject: Re: 7.4 - FK constraint performance
In-Reply-To: <20040213065530.M19832@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox