Skip to content

Commit

Permalink
perf: xml query refactoring
Browse files Browse the repository at this point in the history
Benchmark shows perf. boost for the String data type on big collections.
  • Loading branch information
yv989c committed May 19, 2023
1 parent 17170eb commit 88b7068
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override string GetSqlForComplexTypes(IEntityOptionsBuilder entityOpti
sb
.Append("\tI.value('@")
.Append(QueryableValuesEntity.IndexPropertyName)
.Append("[1] cast as xs:integer?', 'int') AS [")
.Append(" cast as xs:integer?', 'int') AS [")
.Append(QueryableValuesEntity.IndexPropertyName)
.Append(']');

Expand All @@ -54,7 +54,7 @@ protected override string GetSqlForComplexTypes(IEntityOptionsBuilder entityOpti

var targetName = mapping.Target.Name;

sb.Append("\tI.value('@").Append(targetName).Append("[1] cast as ");
sb.Append("\tI.value('@").Append(targetName).Append(" cast as ");

switch (mapping.TypeName)
{
Expand Down Expand Up @@ -122,7 +122,7 @@ protected override string GetSqlForComplexTypes(IEntityOptionsBuilder entityOpti
}

sb.AppendLine();
sb.Append("FROM {0}.nodes('/R/V') N(I)").AppendLine();
sb.Append("FROM {0}.nodes('/R[1]/V') N(I)").AppendLine();
sb.Append("ORDER BY [").Append(QueryableValuesEntity.IndexPropertyName).Append(']');

return sb.ToString();
Expand Down

0 comments on commit 88b7068

Please sign in to comment.