Search Postgresql Archives

Re: "not in" clause too slow?

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

 



Ottavio Campana <ottavio@xxxxxxxxxxxxx> írta:

> mytable.id is primary key.
> 
> I create copy_mytable with
> create table copy_mytable as (select * from mytable);
> 
> the planer behavior does not change no matter if I create and index
> on copy_mytable.id or not.


Try this, with an index on copy_mytable.id:

SELECT orig.* FROM mytable AS orig WHERE NOT EXISTS (
  SELECT 1 FROM copy_mytable AS copy WHERE copy.id = orig.id
);


Regards,
Denes Daniel

Olvasd az [origo]-t a mobilodon: mini magazinok a Mobizin-en
___________________________________________________
www.t-mobile.hu/mobizin


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux