Re: all foreign key should have index?

From: Christopher Browne <cbbrowne_at_acm.org>
Date: Tue, 31 Jan 2006 09:31:30 -0800
Message-ID: <m364o0fgnh.fsf_at_mobile.int.cbbrowne.com>


>> No. But better SQL products construct a "PK=FK" index under the
>> covers for you.
>
> Do you have a list of those?
>
> Is it configurable? I'm not sure I want my rdbms generating a 5GB index on
> my foreign key when I might not require it.
>
> Backup bloat to start with.

If the index required will be 5GB in size, then you probably can't operate _without_ it because each FK check would require a hideous Seq Scan across a 10GB table to do its check.

If you want a case for *not* needing the index, use the one that's sensible, namely the case where the table referenced is only a few pages in size such that the sequential scan is expected to be faster than an index scan...

-- 
wm(X,Y):-write(X),write('_at_'),write(Y). wm('cbbrowne','gmail.com').
http://linuxdatabases.info/info/lisp.html
"640K ought to be enough for anybody" -- Bill Gates - 1981
Received on Tue Jan 31 2006 - 18:31:30 CET

Original text of this message