Optimized Query Select statement question

2 posts, 0 answers
  1. Sompop
    Sompop avatar
    1 posts
    Member since:
    Jan 2009

    Posted 31 May 2012 Link to this post

    Hi,

    From the example on this page http://demos.telerik.com/aspnet-ajax/scheduler/examples/optimizedqueries/defaultcs.aspx# 

    SELECT * FROM [Appointments] WHERE ([Start] < @RangeEnd AND [End] > @RangeStart) OR ([RecurrenceRule] <> '') OR ([RecurrenceParentID] IS NOT NULL) 

    I see that the select statement retrieved recurring events events using [RecurrenceRule] <> '' which is good. My question is why do you need the "OR ([RecurrenceParentID] IS NOT NULL)" ? From what I understand, an appointment has RecurrenceParentID only when it's modified from a recurring series and then a new row in Appointments table will be created. The first where clause (start < @rangeEnd...) should already retrieve those in the visible start/end. If you include the RecurrenceParentID IS NOT NULL wouldn't that unnecessary retrieve more appointments than needed?

    Thanks
     

  2. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 01 Jun 2012 Link to this post

    Hi Sompop,

     
    This statement is set because those appointments that are recurrent and the Master appointment starts before the visible range and their occurrences or exceptions are part of the visible range. If they are not loaded some appointments may not be loaded event though they should be.

    Hope this will explain the issue.

    All the best,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top