|Subject||RE: [firebird-support] Re: How can I skip an Insert ?|
> > > The thing I am trying to do is that I have 2 tables (tab1 andDon't tell us that you created the PK, then wnet and added separate index on
> > > I want to store the data form tab1 in tab2 IF tab2 doesn't
> > > have it. It is so simple, I do this usually but now, the table
> > > too large and when I write my query using something like
> > > INSERT id, c1, c2, c3 IN tab2 FROM tab1 WHERE NOT EXISTS (SELECT
> > > FROM tab2 WHERE tab1.id = tab2.id) it is really terribly long.
> > This query is slow even when you are searching by the primary key?
> Yes it is, and they are indexes!
If so then that is why it's slow. You are confusing the optimiser.
Remove the manually placed index. A PK gets an ascending index already.