Handling duplicate records

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Fri Jan 4 07:41:57 CST 2013


On 1/3/13 4:14 PM, "Beatrix Willius" <bwillius at gmx.de> wrote:

Hi Beatrix, 

> In my email archiving application it's typical to archive emails a few times
> where duplicate handling is done in the application. And this I wanted to
> speed up.
> 
> First I tried to get the message id faster. But I just made the archival
> slower or not really faster.
> 
> Then I had a look at archival with Instruments. To my astonishment I found
> that the following code takes quite a while:
> 
>   dim UniqueCursor as VCursor = theArchive.SqlSelect("select RecID from
> message where InternalMessageID = '" +
> Valentina.EscapeString(Left(InternalMessageID, 100)) + "'",
> EVCursorLocation.kServerSide, EVLockType.kReadOnly,
> EVCursorDirection.kForwardOnly)
>   if UniqueCursor <> Nil and UniqueCursor.RecordCount > 0 then
>     Return False
>   Else
>     Return True
>   End If

This happens in loop somehow?

Working with SQL and cursors one of best ways to speed up is
to use SQL binding


--
I have not catch very good your task Beatrix,
I see msg about BitSets.

May be show code to us based on bitset


Btw, immediately. You try to find IF some ID already exists in table?
And you use I think some Vfield.Find()  which returns BitSet.

I think, in your case EXPECTED result is e.g. 0, 1, 2, 3 - small number,
Even for table with million records.

Then better/faster to use ArryaSet than BitSet.


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list