pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
NOT-IN CLAUSE
2+ messages / 2 participants
[nested] [flat]

* NOT-IN CLAUSE
@ 2003-12-15 17:14 Prashant Dalal <pdalal@laborlogix.com>
  2003-12-15 19:28 ` Re: NOT-IN CLAUSE Bruno Wolff III <bruno@wolff.to>
  0 siblings, 1 reply; 2+ messages in thread

From: Prashant Dalal @ 2003-12-15 17:14 UTC (permalink / raw)
  To: pgsql-sql

Hi,

My Following select st. is running from last one day. I think the problem is
NOT IN clause.
Please suggest the alternative select clause.



SELECT resreq.proj, resreq.ver, substr(resreq.act, -5, 5) act, resreq.rn,
null, 
       null, resreq.rl, resreq.dr, resreq.ra
    FROM resreq
    WHERE resreq.ver IN ('0', '99')
      AND NOT (resreq.proj, resreq.ver, substr(resreq.act, -5, 5),
resreq.rn)
          IN (SELECT actres.proj, actres.ver, substr(actres.act, -5, 5) act,

                      actres.rn
               FROM actres, resreq
               WHERE actres.proj = resreq.proj
                 AND actres.ver = resreq.ver
                 AND substr(actres.act, -5, 5) = substr(resreq.act, -5, 5)
                 AND actres.rn = resreq.rn
                 AND actres.ver IN ('0', '99'))




Best Regards,
Prashant Dalal.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LaborLogix

Attachments:

  winmail.dat (application/ms-tnef, 1.6K) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: NOT-IN CLAUSE
  2003-12-15 17:14 NOT-IN CLAUSE Prashant Dalal <pdalal@laborlogix.com>
@ 2003-12-15 19:28 ` Bruno Wolff III <bruno@wolff.to>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruno Wolff III @ 2003-12-15 19:28 UTC (permalink / raw)
  To: Prashant Dalal <pdalal@laborlogix.com>; +Cc: pgsql-sql

On Mon, Dec 15, 2003 at 12:14:17 -0500,
  Prashant Dalal <pdalal@laborlogix.com> wrote:
> Hi,
> 
> My Following select st. is running from last one day. I think the problem is
> NOT IN clause.
> Please suggest the alternative select clause.

NOT IN was especially slow up until Postgres 7.4. If using 7.4 is a problem
you can rewrite your query to use NOT EXISTS.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-12-15 19:28 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-15 17:14 NOT-IN CLAUSE Prashant Dalal <pdalal@laborlogix.com>
2003-12-15 19:28 ` Bruno Wolff III <bruno@wolff.to>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox