This is a migrated thread and some comments may be shown as answers.

How to avoid uneccessary SQL requests?

1 Answer 46 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bernd
Top achievements
Rank 2
Bernd asked on 19 Sep 2016, 08:23 AM

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.

SELECT TOP (@__TAKE)
    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.

1 Answer, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 22 Sep 2016, 03:15 PM
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.

Regards,
Doroteya
Telerik by Progress
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
Data Access Free Edition
Asked by
Bernd
Top achievements
Rank 2
Answers by
Doroteya
Telerik team
Share this question
or