Re: Interesting Query Performance Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David W Noon <dwnoon@xxxxxxxxxxxx> writes:
> On Sat, 06 Nov 2010 11:59:48 -0400, Tom Lane wrote about Re: 
>> In general, NOT IN is hard to optimize because of its weird behavior
>> for NULLs.  I'd suggest looking into converting the query to use an
>> EXISTS instead.

> I have know about that issue for some years, so I always use a column
> that has been declared NOT NULL for the sub-query.  Does PostgreSQL not
> use that property to bypass the vagaries of NULL in an IN predicate?

No.  It's a reasonable TODO item though.  Up till fairly recently, we
didn't have infrastructure that would allow building plans that depended
for correctness on the existence of a constraint.  (In particular,
I'd want such a plan to get thrown away and redone if someone dropped
the NOT NULL constraint.)  We have most of that now, although it only
works for constraints that have entries in pg_constraint, which NOT NULL
doesn't yet.  Maybe in another few months ...

			regards, tom lane

-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux