From: Tom Lane <tgl@sss.pgh.pa.us>
To: ow <oneway_111@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: 7.4 - FK constraint performance
Date: Thu, 12 Feb 2004 19:00:25 -0500
Message-ID: <24947.1076630425@sss.pgh.pa.us> (raw)
In-Reply-To: <20040212214923.98051.qmail@web60803.mail.yahoo.com>
References: <20040212214923.98051.qmail@web60803.mail.yahoo.com>
ow <oneway_111@yahoo.com> writes:
> --- Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think it must be using a seqscan for the foreign key check query.
> 2) prepare foo(my.dint) as
> SELECT 1 FROM ONLY "my"."large" x WHERE "small_id" = $1 FOR UPDATE OF x;
> explain analyze execute foo(201);
> QUERY PLAN
> Seq Scan on large x (cost=0.00..1787052.30 rows=7893843 width=6) (actual
> time=210566.301..210566.301 rows=0 loops=1)
> Filter: ((small_id)::integer = ($1)::integer)
> Total runtime: 210566.411 ms
Well, there's the smoking gun all right. Why does it think there are
going to be 7893843 matching rows!? Could we see the pg_stats row for
the large.small_id column?
regards, tom lane
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, oneway_111@yahoo.com
Subject: Re: 7.4 - FK constraint performance
In-Reply-To: <24947.1076630425@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