Re: 7.4 - FK constraint performance

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Rod Taylor <rbt(at)rbt(dot)ca>, ow <oneway_111(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: 7.4 - FK constraint performance
Date: 2004-02-13 16:08:41
Message-ID: 20040213080628.E21355@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql


On Fri, 13 Feb 2004, Tom Lane wrote:

> Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> > On Fri, 13 Feb 2004, Tom Lane wrote:
> >> I was looking at that last night. It seems like we could add a LIMIT at
> >> least in some contexts. In the case at hand, we're just going to error
> >> out immediately if we find a matching row, and so there's no need for
> >> FOR UPDATE, is there?
>
> > I think there still is, because a not yet committed transaction could have
> > deleted them all in which case I think the correct behavior is to wait and
> > if that transaction commits allow the action and if it rolls back to
> > error.
>
> Good point. Okay, we can't put in a LIMIT. But we could still hack the
> planner to prefer a fast-start plan by passing an out-of-band tuple
> fraction, for those RI plans where it's appropriate. That would not
> affect correctness.

Right, I can try to look through the stuff you pointed at in the previous
message over the weekend.

> >> However, I'm not sure it would help the OP anyway. With the stats he
> >> had, the planner would still take a seqscan, because it's going to
> >> expect that it can find a match by probing the first ten or so rows of
> >> the first page. With anything close to the normal cost parameters,
> >> that's going to look more expensive than an index probe.
>
> s/more expensive/less expensive/ ... need more caffeine obviously ...

Me too apparently, since I knew what you were saying and agreed despite
the wording.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB SD 2004-02-13 16:42:36 Re: Transaction aborts on syntax error.
Previous Message Tom Lane 2004-02-13 15:56:44 Re: 7.4 - FK constraint performance

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2004-02-13 16:33:42 Re: arrays and polygons
Previous Message Tom Lane 2004-02-13 15:56:44 Re: 7.4 - FK constraint performance