Alban Hertroys ha scritto:
Ottavio Campana wrote:
2) how can I speed it up? by using indexes? or by changing the query?
Do you have indices on mytable.id and copy_mytable.id?
Does using NOT EXISTS get you any better results?
Eventually I had to select not all the table fields but only the
On Fri, Sep 21, 2007 at 12:09:50PM +0200, Ottavio Campana wrote:
2) how can I speed it up? by using indexes? or by changing the query?
Note that NOT IN cannot be optimised in the same way as NOT EXISTS due
to the different ways they handle NULL. In particular if the subquery
of the NOT IN
Ottavio Campana wrote:
2) how can I speed it up? by using indexes? or by changing the query?
Do you have indices on mytable.id and copy_mytable.id?
Does using NOT EXISTS get you any better results?
db=# EXPLAIN ANALYZE select * from mytable where id not in (select id
from copy_mytable);
mytable has 1857 rows, copy_mytable is a copy of mytable and I want to
know which new rows have been entered. I used the where id not in, and
the query works. My problem is that if I run the same command on another
table with 378415 rows, it is terribly slow. I ran explain analyze on
the first
Alban Hertroys ha scritto:
Ottavio Campana wrote:
2) how can I speed it up? by using indexes? or by changing the query?
Do you have indices on mytable.id and copy_mytable.id?
Does using NOT EXISTS get you any better results?
mytable.id is primary key.
I create copy_mytable with
create
On 9/21/07, Ottavio Campana [EMAIL PROTECTED] wrote:
My problem is that if I run the same command on another
table with 378415 rows, it is terribly slow.
How much is terribly slow?
Did you VACUUM ANALYZE?
Anyways, try this:
SELECT * FROM MYTABLE T1
LEFT JOIN COPY_MYTABLE T2
ON T1.ID = T2.ID