Subject Re: Insert succesfull while violating primary key constraint
Author olivier_olmer
Have you ever tried to run a query

delete from TableName T1
where exists ( select * from TableName T2
where T1.PKID=T2.PKID
and T1.RDB$db_key<T2.RDB$db_key);

when the table contains 4 million records?

So I am still thinking about which approach I should use to remove
the double records.
Posibilities:
- Select distinct * for each table and export it as raw data and
import it again
- Copy the database using a custom made application which tries to
insert each record and if it fails I do not mind.

Does somebody know if it is possible to run queries accross multiple
database for this use?

With kind regards

Olivier Olmer

--- In firebird-support@yahoogroups.com, Alan McDonald <alan@m...>
wrote:
> Hey,
> Olivier, have you noticed any improvement in database performance
over your
> 4million records now that you have indexes turn on?
>
> It should be really good now.
> Alan
>
> > -----Original Message-----
> > From: olivier_olmer [mailto:olivier_olmer@y...]
> > Sent: Thursday, 19 June 2003 9:49 PM
> > To: firebird-support@yahoogroups.com
> > Subject: [firebird-support] Re: Insert succesfull while violating
> > primary key constraint
> >
> >
> > Hi Helen,
> >
> > You are right! Thank you The indexes are disabled. Actually all
the
> > indexes of all tables are inactive. Since I know for sure we did
not
> > alter indexes to deactivate them. Simply we did not know this
feature.
> >
> > I like to know what else could cause this to happen.
> > The only thing we have done is dropping foreign key constraints to
> > speed up the delete of about 4.000.0000 records.
> >
> > With kind regards,
> >
> > Olivier Olmer
> > Oxolutions
> >
> >
> >
> >
> >
> > --- In firebird-support@yahoogroups.com, Helen Borrie
<helebor@t...>
> > wrote:
> > > At 09:01 AM 19/06/2003 +0000, you wrote:
> > > >We experienced succesful inserts in the database while it is
> > > >violating the primary key constraint.
> > > >This appeared using firebird 1.02 with multiple files. Even
after
> > > >backup restore this still is the case.
> > > >
> > > >This problem does not appear till we dropped some foreign key
> > > >constraints by its name.
> > > >
> > > >Two questions:
> > > >How do I solve the problem of deleting the double records
(since
> > they
> > > >are exactly the same?
> > >
> > > See Alan's post.
> > >
> > > >Which version of firebird is reliable on testing the primary
key
> > > >constraint.
> > >
> > > All. I've only ever seen this occur where the programmer had
taken
> > advice
> > > to set indexes inactive while doing bulk inserts, so he took it
> > literally
> > > and disabled them all, including the unique index that system
> > created to
> > > enforce the PK!!
> > >
> > > heLen
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > firebird-support-unsubscribe@yahoogroups.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >