Subject Re: Insertion speed
Author Svein Erling Tysvær
--- In firebird-support@yahoogroups.com, "Todd Pinel" wrote:
> SELECT BP.BUYER_NO
> FROM BUYERPUBLICATION BP
> WHERE BP.PUBLICATION_NO = :PUBLICATION_NO
> AND NOT EXISTS(SELECT IM.BUYER_NO
> FROM ISSUESMAILED IM
> WHERE IM.BUYER_NO = BP.BUYER_NO
> AND IM.ISSUE_NO = :ISSUE_NO)

Hmm, that looks pretty OK!

> PLAN (IM INDEX (INTEG_132,INTEG_177)) PLAN (BP INDEX
> (FK_BUYERPUBLICATIONPUBLICAT))

Ouch, I dislike using indexes for both buyer_no and issue_no. Assuming
that issue_no is far less selective than buyer_no (hopefully, you sell
100000 copies of each issue ;o), try changing one line to

AND IM.ISSUE_NO+0 = :ISSUE_NO

and you should observe a - hopefully dramatic - improvement (except
for issues being sold to a handful of buyers).

HTH,
Set