Re: "SELECT .. WHERE NOT IN" query running for hours

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>
Cc: Γιωργος Βαλκανας <lebiathan(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: "SELECT .. WHERE NOT IN" query running for hours
Date: 2011-01-14 19:01:23
Message-ID: AANLkTimPFtZzR=L_fztok-xcKiQYvgQAiFt=AtY8_9+U@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

2011/1/10 Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>:
> Well, I really hoped that Bruce, Robert or Greg would take on this one, but
> since there are no more qualified takers, I'll take a shot at this one. For
> the "NOT IN (result of a correlated sub-query)", the sub-query needs to be
> executed for every row matching the conditions on the driving table, while
> the   !EXISTS is just a complement of join. It's all in the basic set theory
> which serves as a model for the relational databases.

As Scott says, the real problem is the NULL handling. The semantics
are otherwise similar.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2011-01-14 19:03:47 Re: Problems with FTS
Previous Message Robert Haas 2011-01-14 18:03:34 Re: plan question - query with order by and limit not choosing index depends on size of limit, table