Subject | Re: [firebird-support] Insertion speed |
---|---|
Author | Gary Benade |
Post date | 2005-02-10T19:29:43Z |
> Thanks for all the help and tips. I have to admit that my simple querychange to this and see if there is an improvement. Helen pointed it out to
> wasn't quite as simple as originally stated. What it was trying to
> achieve
> was something like this
> FOR
> 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)
> INTO :BUYER_NO
> DO
> BEGIN
> //INSERT BUYER_NO INTO OTHER TABLE
> END
me once and it made a huge difference (still not 100% sure why). BTW. is
there an index on ISSUESMAILED( BUYER_NO) and/or ISSUESMAILED( ISSUE_NO)
FOR
SELECT BP.BUYER_NO
FROM BUYERPUBLICATION BP
WHERE BP.PUBLICATION_NO = :PUBLICATION_NO
AND NOT EXISTS(SELECT 1
FROM ISSUESMAILED IM
WHERE IM.BUYER_NO = BP.BUYER_NO
AND IM.ISSUE_NO = :ISSUE_NO)
INTO :BUYER_NO
DO
BEGIN
//INSERT BUYER_NO INTO OTHER TABLE
END