Re: FindRow vs. Restrict/SortTable

Tech-Archive recommends: Fix windows errors by optimizing your registry



You could, but since the table is not restricted and if, say, only 10
messages match your criteria, you will end up reading 990 rows that do not
match your restriction. In other words, if one row matches your restriction,
there is no guarantee that the next row will, hence your need to read one
row at a time.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Jon Goldberg" <jong@xxxxxxxxxxxxx> wrote in message
news:OCJS0nGQFHA.3076@xxxxxxxxxxxxxxxxxxxxxxx
> That sounds good.
>
> But is there a reason why you are repeatedly calling FindRow and then
> QueryRows(1)? If I want the first 1000 messages, can't I call FindRow
> once with the restriction, and then call QueryRows(1000) to get the rows
> in one shot?
>
> thanks,
> Jon
>
> Dmitry Streblechenko wrote:
>
>> No, a new index won't get created since nothing really changes, you only
>> suply the prop tag (PR_MESSAGE_DELIVERY_TIME) to sort on, but not the
>> (potentially) dynamic restriction value, as in Restrict().
>> Call
>>
>> if SortTable,
>> if FindRow(BOOKMARK_BEGINNING, ...)
>> if QueryRows(1)
>> loop FindRow(BOOKMARK_CURRENT, ...)/QueryRows(1)
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "Jon Goldberg" <jong@xxxxxxxxxxxxx> wrote in message
>> news:u4%23NcyFQFHA.1884@xxxxxxxxxxxxxxxxxxxxxxx
>>
>>>Thanks for your speedy response. A few followup questions:
>>>
>>>1. When you say to retrieve the rows one by one using FindRow, do you
>>>mean that I would execute:
>>>
>>>a. call SortTable to create the server-side index
>>>b. call FindRow with my SRestriction instead of calling Restrict
>>>c. call QueryRows to get the batch of messages
>>>
>>>Right now I call Restrict first, then SortTable, and then QueryRows.
>>>
>>>2. Once I call SortTable, the server-side index is created. If I call it
>>>again and the index hasn't been aged out, is there any associated cost?
>>>I want to make sure that I don't create a new index every time I
>>>call SortTable.
>>>
>>>thanks again,
>>> Jon
>>>
>>>Dmitry Streblechenko wrote:
>>>
>>>
>>>>Try to sort the table first (that will create an index on
>>>>PR_MESSAGE_DELIVERY_TIME on the server, which probably a good thing),
>>>>then retireve the rows one by one using FindRow.
>>>>
>>>>Dmitry Streblechenko (MVP)
>>>>http://www.dimastr.com/
>>>>OutlookSpy - Outlook, CDO
>>>>and MAPI Developer Tool
>>>>
>>>>"Jon Goldberg" <jong@xxxxxxxxxxxxx> wrote in message
>>>>news:e7AyVdEQFHA.4052@xxxxxxxxxxxxxxxxxxxxxxx
>>>>
>>>>
>>>>>Hi-
>>>>>
>>>>>I need to process messages in a folder in order of deliver time
>>>>>(PR_MESSAGE_DELIVERY_TIME). I progressively get a batch of messages
>>>>>with QueryRows after calling Restrict to a specific date range and then
>>>>>SortTable to make sure the messages are retrieved in date order. Now I
>>>>>realize that cached restrictions will be adversely affecting my
>>>>>Exchange Server performance. I want to change to an approach that
>>>>>doesn't cache any restrictions (using FindRows, I guess).
>>>>>
>>>>>However, I need to make sure that I am processing messages in date
>>>>>order. Is there any way to do this without creating a restricted search
>>>>>folder on the server? Or to create an index that is temporary and does
>>>>>not impose a load on the server whenever updates happen to the folder?
>>>>>
>>>>>thanks for any ideas,
>>>>>Jon
>>>>
>>>>
>>


.



Relevant Pages

  • Re: IMAPITable::Restrict return value
    ... Can you tell how much restrictions can I create and use in one session so that I would't waste with them on Exchange? ... Dmitry Streblechenko wrote: ... FindRow will return after finding the first match, while Restrict will still go over all the items. ... OutlookSpy - Outlook, CDO ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Search in GAL
    ... When using PR_ANR, you need to call Restrict, not FindRow. ... OutlookSpy - Outlook, CDO ... and MAPI Developer Tool ... Dmitry Streblechenko wrote: ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Filter address book on PR_EMS_AB_HOME_MDB
    ... Any call I try with FindRow just fails. ... it's an entry from another mail server. ... Dmitry Streblechenko wrote: ... > OutlookSpy - Outlook, CDO ...
    (microsoft.public.win32.programmer.messaging)
  • Re: FindRow vs. Restrict/SortTable
    ... In my case, if my Restriction is a range query on the same criteria as my SortTable, I don't need to worry about it and can just do one call to QueryRows. ... OutlookSpy - Outlook, CDO ... If I want the first 1000 messages, can't I call FindRow once with the restriction, and then call QueryRowsto get the rows in one shot? ... Now I realize that cached restrictions will be adversely affecting my Exchange Server performance. ...
    (microsoft.public.win32.programmer.messaging)
  • Re: FindRow vs. Restrict/SortTable
    ... FindRow with the Restriction for RELOP_GT startDate and RELOP_LE endDate, ... OutlookSpy - Outlook, CDO ... Now I realize that cached restrictions will be adversely affecting my Exchange Server performance. ...
    (microsoft.public.win32.programmer.messaging)