Re: FindRow vs. Restrict/SortTable
- From: "Dmitry Streblechenko" <dmitry@xxxxxxxxxxx>
- Date: Thu, 14 Apr 2005 10:08:33 -0700
That would work for a restriction on a single prop, but how do you sort on a
range? You can set to sort on one (or more) prop, but how do you sort in
such a way that rows that satisfy a range restriction come up first?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Jon Goldberg" <jong@xxxxxxxxxxxxx> wrote in message
news:uOhmzdIQFHA.4052@xxxxxxxxxxxxxxxxxxxxxxx
> That makes sense.
>
> In my case, if my Restriction is a range query (RELOP_GT) on the same
> criteria as my SortTable (PR_MESSAGE_DELIVERY_TIME), I don't need to worry
> about it and can just do one call to QueryRows. I know that every row I
> get back will satisfy my Restriction since the results are already sorted.
>
> If I had a more complex Restriction (or one that used completely different
> criteria than my SortTable), I'd need to read them one row at a time.
>
> thanks,
> Jon
>
> Dmitry Streblechenko wrote:
>
>> 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
>>>>>>
>>>>>>
>>
.
- Follow-Ups:
- Re: FindRow vs. Restrict/SortTable
- From: Jon Goldberg
- Re: FindRow vs. Restrict/SortTable
- References:
- FindRow vs. Restrict/SortTable
- From: Jon Goldberg
- Re: FindRow vs. Restrict/SortTable
- From: Dmitry Streblechenko
- Re: FindRow vs. Restrict/SortTable
- From: Jon Goldberg
- Re: FindRow vs. Restrict/SortTable
- From: Dmitry Streblechenko
- Re: FindRow vs. Restrict/SortTable
- From: Jon Goldberg
- Re: FindRow vs. Restrict/SortTable
- From: Dmitry Streblechenko
- Re: FindRow vs. Restrict/SortTable
- From: Jon Goldberg
- FindRow vs. Restrict/SortTable
- Prev by Date: Re: Is there a limit for additional Message Stores for a profile...
- Next by Date: Re: MAPI mail stuck in Outlook's outbox?
- Previous by thread: Re: FindRow vs. Restrict/SortTable
- Next by thread: Re: FindRow vs. Restrict/SortTable
- Index(es):
Relevant Pages
|