Re: [GENERAL] Curious why planner can't handle NOT IN

2013-05-03 Thread pradeep singh
On May 3, 2013 12:15 PM, "Yang Zhang" wrote: > I have an `account` table with 5.3M rows, with primary key `id` of > type `text` (and 600+ columns if that matters). > > I'm trying to create a `newaccount` table with the same schema but > 600k newly imported rows, then insert all the old rows for w

Re: [GENERAL] Curious why planner can't handle NOT IN

2013-05-03 Thread Tom Lane
Yang Zhang writes: > The most obvious query doesn't work so hot due to repeated execution > of the subplan: > => explain insert into newaccount select * from account where id not > in (select id from account); Yeah. Try using a NOT EXISTS instead. > This isn't a big deal as there's a straightf

[GENERAL] Curious why planner can't handle NOT IN

2013-05-02 Thread Yang Zhang
I have an `account` table with 5.3M rows, with primary key `id` of type `text` (and 600+ columns if that matters). I'm trying to create a `newaccount` table with the same schema but 600k newly imported rows, then insert all the old rows for which `id` isn't already in the set of newly updated rows