pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
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 10:56:44 -0500
Message-ID: <2662.1076687804@sss.pgh.pa.us> (raw)
In-Reply-To: <20040213073852.K20792@megazone.bigpanda.com>
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>
	<20040213065530.M19832@megazone.bigpanda.com>
	<2455.1076686047@sss.pgh.pa.us>
	<20040213073852.K20792@megazone.bigpanda.com>

Stephan Szabo <sszabo@megazone.bigpanda.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.

>> 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 ...

			regards, tom lane



view thread (29+ messages)  latest in thread

Message-ID: <2662.1076687804@sss.pgh.pa.us>
Permalink:  ../2662.1076687804@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2662.1076687804@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, sszabo@megazone.bigpanda.com, rbt@rbt.ca, oneway_111@yahoo.com
  Subject: Re: 7.4 - FK constraint performance
  In-Reply-To: <2662.1076687804@sss.pgh.pa.us>

* 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