Seeing foreign key lookups in explain output - Mailing list pgsql-general

From Vincent de Phily
Subject Seeing foreign key lookups in explain output
Date
Msg-id 3798971.mRNc5JcYXj@moltowork
Whole thread Raw
Responses Re: Seeing foreign key lookups in explain output  (Marti Raudsepp <marti@juffo.org>)
List pgsql-general
Hi list,

an explain analyze wish :

create table t1(id serial primary key);
create table t2(id serial primary key,
                ref integer references t1(id) on delete cascade);
...insert many rows in both tables...
explain delete from t1 where id < 10000;
...
The explain output will tell me it's using the index on t1's id, but it tells
me nothing about the seqscan that happens on t2 (because I forgot to add an
index on t2.ref).

It isn't the first time I get bitten by this, and I bet I'm not the only one.
The explain tells me everything will work fast, but reallity is 100 times
slower. Is there a way I can extend explain output to show the rest of the
work done behind the scene ? Fixing that performance issue is easy once you
see it, but most people will just look at the explain output and erroneously
conclude "it's as good as it gets".

--
Vincent de Phily

pgsql-general by date:

Previous
From: Leonardo Francalanci
Date:
Subject: cache oblivious indexes (tokudb, fractal indexes)
Next
From: Szymon Guz
Date:
Subject: not enough disk space