From 79981d1ffb54326b3a5b32cf7e6fcd9853b95741 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Wed, 22 Jan 2025 14:54:16 +0500 Subject: [PATCH 1/2] Postgresql: Declare the same setting for nulls in indexes as in order by statement otherwise, index order conflicts with order by which cause longer query execution. According to documentation default settings for nulls are exact opposite. --- .../Sql.Drivers.PostgreSql/v9_0/Translator.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v9_0/Translator.cs b/Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v9_0/Translator.cs index 22233fd625..cf3954edd8 100644 --- a/Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v9_0/Translator.cs +++ b/Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v9_0/Translator.cs @@ -30,6 +30,9 @@ public override void Translate(SqlCompilerContext context, object literalValue) } } + public override void TranslateSortOrder(IOutput output, bool ascending) => + output.Append(ascending ? "ASC NULLS FIRST" : "DESC NULLS LAST"); + // Constructors public Translator(SqlDriver driver) From 06d0f1cb64386c3e4f5bd26de96f30b2b1911a1e Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Fri, 24 Jan 2025 13:32:48 +0500 Subject: [PATCH 2/2] Improve changelog --- ChangeLog/7.1.4_dev.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog/7.1.4_dev.txt b/ChangeLog/7.1.4_dev.txt index 754f28c4ee..2c98bef46b 100644 --- a/ChangeLog/7.1.4_dev.txt +++ b/ChangeLog/7.1.4_dev.txt @@ -1,2 +1,3 @@ [main] Addressed IndexOutOfRangeException on translation of certain queries with aggregates -[main] Notification to BuildLog when a hierarchy changes KeyGeneratorKind value to None \ No newline at end of file +[main] Notification to BuildLog when a hierarchy changes KeyGeneratorKind value to None +[postgresql] Added explicit nulls setting for both column order directions to improve OrderBy/OrderByDescending performance \ No newline at end of file