You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT
[t].[PersistenceId],
[t].[CompleteTime],
[t].[CreateTime],
[t].[Data], -- this is the cause of large dataflow (duplication)
[t].[Description],
[t].[InstanceId],
[t].[NextExecution],
[t].[Reference],
[t].[Status],
[t].[Version],
[t].[WorkflowDefinitionId],
[t0].[PersistenceId],
[t0].[Active],
[t0].[Children],
[t0].[ContextItem],
[t0].[EndTime],
[t0].[EventData],
[t0].[EventKey],
[t0].[EventName],
[t0].[EventPublished],
[t0].[Id],
[t0].[Outcome],
[t0].[PersistenceData],
[t0].[PredecessorId],
[t0].[RetryCount],
[t0].[Scope],
[t0].[SleepUntil],
[t0].[StartTime],
[t0].[Status],
[t0].[StepId],
[t0].[StepName],
[t0].[WorkflowId],
[t0].[PersistenceId0],
[t0].[AttributeKey],
[t0].[AttributeValue],
[t0].[ExecutionPointerId]
FROM (
SELECT TOP(1)
[w].[PersistenceId],
[w].[CompleteTime],
[w].[CreateTime],
[w].[Data],
[w].[Description],
[w].[InstanceId],
[w].[NextExecution],
[w].[Reference],
[w].[Status],
[w].[Version],
[w].[WorkflowDefinitionId]
FROM [wfc].[Workflow] AS [w]
WHERE [w].[InstanceId] = {uid}
) AS [t]
LEFT JOIN (
SELECT
[e].[PersistenceId],
[e].[Active],
[e].[Children],
[e].[ContextItem],
[e].[EndTime],
[e].[EventData],
[e].[EventKey],
[e].[EventName],
[e].[EventPublished],
[e].[Id],
[e].[Outcome],
[e].[PersistenceData],
[e].[PredecessorId],
[e].[RetryCount],
[e].[Scope],
[e].[SleepUntil],
[e].[StartTime],
[e].[Status],
[e].[StepId],
[e].[StepName],
[e].[WorkflowId],
[e0].[PersistenceId] AS [PersistenceId0],
[e0].[AttributeKey],
[e0].[AttributeValue],
[e0].[ExecutionPointerId]
FROM [wfc].[ExecutionPointer] AS [e]
LEFT JOIN [wfc].[ExtensionAttribute] AS [e0] ON [e].[PersistenceId] = [e0].[ExecutionPointerId]
) AS [t0] ON [t].[PersistenceId] = [t0].[WorkflowId]
ORDER BY [t].[PersistenceId], [t0].[PersistenceId], [t0].[PersistenceId0];
Our case contains a large amount of information in the Data column. It leads to performance degradation due to the large amount of duplicate data when the query is executed.
To avoid this side effect, you can split the query.
SELECT TOP(1)
[w].[PersistenceId],
[w].[CompleteTime],
[w].[CreateTime],
[w].[Data],
[w].[Description],
[w].[InstanceId],
[w].[NextExecution],
[w].[Reference],
[w].[Status],
[w].[Version],
[w].[WorkflowDefinitionId]
FROM [wfc].[Workflow] AS [w]
WHERE [w].[InstanceId] = {uid}
ORDER BY [w].[PersistenceId]
SELECT
[e0].[PersistenceId],
[e0].[AttributeKey],
[e0].[AttributeValue],
[e0].[ExecutionPointerId],
[t].[PersistenceId],
[e].[PersistenceId]
FROM (
SELECT TOP(1) [w].[PersistenceId]
FROM [wfc].[Workflow] AS [w]
WHERE [w].[InstanceId] = {uid}
) AS [t]
INNER JOIN [wfc].[ExecutionPointer] AS [e] ON [t].[PersistenceId] = [e].[WorkflowId]
INNER JOIN [wfc].[ExtensionAttribute] AS [e0] ON [e].[PersistenceId] = [e0].[ExecutionPointerId]
ORDER BY [t].[PersistenceId], [e].[PersistenceId]
SELECT
[e].[PersistenceId],
[e].[Active],
[e].[Children],
[e].[ContextItem],
[e].[EndTime],
[e].[EventData],
[e].[EventKey],
[e].[EventName],
[e].[EventPublished],
[e].[Id],
[e].[Outcome],
[e].[PersistenceData],
[e].[PredecessorId],
[e].[RetryCount],
[e].[Scope],
[e].[SleepUntil],
[e].[StartTime],
[e].[Status],
[e].[StepId],
[e].[StepName],
[e].[WorkflowId],
[t].[PersistenceId]
FROM (
SELECT TOP(1) [w].[PersistenceId]
FROM [wfc].[Workflow] AS [w]
WHERE [w].[InstanceId] = {uid}
) AS [t]
INNER JOIN [wfc].[ExecutionPointer] AS [e] ON [t].[PersistenceId] = [e].[WorkflowId]
ORDER BY [t].[PersistenceId], [e].[PersistenceId]
Describe the bug
EntityFrameworkPersistenceProvider class methods for retrieving WorkflowInstance do not generate optimal database queries.
As an example, this code generates a query, which leads to duplicate data from Workflow table.
Code:
Query:
Our case contains a large amount of information in the Data column. It leads to performance degradation due to the large amount of duplicate data when the query is executed.
To avoid this side effect, you can split the query.
Code:
Queries:
Test
From SSMS
[Data] size = 507kB;
Execution pointer count = 1000;
From external source
Count - number of execution pointers;
DataSize - the size of the information in the Data column;
SingleQuery - single query (current impl);
SplitQuery - split queries;
Expected behavior
Fetch data without unnecessary degradation.
The text was updated successfully, but these errors were encountered: