How to avoid uneccessary SQL requests?

2 posts, 0 answers
  1. Bernd
    Bernd avatar
    51 posts
    Member since:
    Feb 2013

    Posted 19 Sep Link to this post

    Hello all.

    In this post I am using DataAccess to populate a grid. Unfortunately there are not really neccessary subsequent requests for the navigation properties generated.

    The main request could be used to popupate the already joined navigation properties (WorkOrder and Operation). Obviously the join is only used for filtering.

        a.[Id] AS COL1,
        a.[ActivityStatus] AS COL2,
        a.[BackgroundColor] AS COL3,
        a.[EventType] AS COL4,
        a.[Description] AS COL5,
        a.[en] AS COL6,
        a.[EventType] AS COL7,
        a.[IsAllDay] AS COL8,
        a.[OperationId] AS COL9,
        a.[OperationId] AS COL10,
        a.[RecurrenceException] AS COL11,
        a.[RecurrenceRule] AS COL12,
        a.[strt] AS COL13,
        a.[Status] AS COL14,
        a.[Title] AS COL15,
        a.[WorkplaceId] AS COL16,
        a.[WorkplaceId] AS COL17
    FROM [CalendarEvent] a
    JOIN [Operation] AS b
      ON (a.[OperationId] = b.[Id])
    JOIN [WorkOrder] AS c
      ON (b.[WorkOrderId] = c.[Id])
    WHERE a.[OperationId] IS NOT NULL
      AND b.[MasterSystemHierarchy] = @p0
      AND NOT ((b.[ProcessingStatus] IN (@p1, @p2)))
      AND c.[QuantityToProduce] - b.[QuantityConfirmed] > 0

    What can I do to improve performance in such cases?

    If you need any additional information not included in the linked post, please let me know.

    Kind regards.

  2. Doroteya
    Doroteya avatar
    497 posts

    Posted 22 Sep Link to this post

    Hi Bernd,

    The easiest way to prevent the additional requests is to use a fetch strategy while executing the main request. More details about the approach are available in this section of our documentation. As a result, the projection retrieved by the main request will be enhanced with the columns of the related tables.

    I hope this helps.

    Telerik by Progress
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  3. DevCraft banner
Back to Top