Subject RE: [firebird-support] Re: How can I skip an Insert ?
Author Alan McDonald
> > > The thing I am trying to do is that I have 2 tables (tab1 and
> tab2).
> > > I want to store the data form tab1 in tab2 IF tab2 doesn't
> already
> > > have it. It is so simple, I do this usually but now, the table
> are
> > > too large and when I write my query using something like
> > > INSERT id, c1, c2, c3 IN tab2 FROM tab1 WHERE NOT EXISTS (SELECT
> id
> > > 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!
>


Don't tell us that you created the PK, then wnet and added separate index on
the field?
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.
Alan