Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [GENERAL] FK index q'n

From: Alvaro Herrera <alvherre(at)alvh.no-ip.org>
Date: Fri Nov 30 2007 - 11:04:27 EST


Tom Lane wrote:
> rihad <rihad@mail.ru> writes:
> > Given this table:
> > CREATE TABLE foo (
> > id integer primary key,
> > bar_id integer references bar (id)
> > );
> > and provided that bar.id is itself a PK, do I still need to create an
> > index on bar_id if often doing queries like:
> > SELECT MIN(id) FROM foo WHERE bar_id IS NULL;
>
> Now as far as the above-illustrated query goes, no simple index is going
> to help it, because IS NULL is not an indexable operation.

Unless you are on 8.3, that is.

-- 
Alvaro Herrera                 
http://www.amazon.com/gp/registry/CTMLCN8V17R4
Y dijo Dios: "Que sea Satanás, para que la gente no me culpe de todo a mí."
"Y que hayan abogados, para que la gente no culpe de todo a Satanás"

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
Received on Fri Nov 30 11:05:44 2007

This archive was generated by hypermail 2.1.8 : Mon Jun 16 2008 - 21:00:51 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library