OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fix[Op#54459]: Remove unnecessary distinct in subselect that degrades performance
Kabiru Mwenja30067c27fef0
diff --git a/app/models/projects/scopes/available_custom_fields.rb b/app/models/projects/scopes/available_custom_fields.rbindex 5122b78038b..5ce046be42b 100644--- a/app/models/projects/scopes/available_custom_fields.rb+++ b/app/models/projects/scopes/available_custom_fields.rb@@ -46,7 +46,6 @@ module Projects::Scopesdef project_custom_fields_project_mapping_subquery(custom_field_ids:)ProjectCustomFieldProjectMapping.select(:project_id).where(custom_field_id: custom_field_ids)- .distinctendendenddiff --git a/spec/models/queries/projects/filters/available_project_attributes_filter_spec.rb b/spec/models/queries/projects/filters/available_project_attributes_filter_spec.rbindex 466a9edea7e..e7c8eb200d7 100644--- a/spec/models/queries/projects/filters/available_project_attributes_filter_spec.rb+++ b/spec/models/queries/projects/filters/available_project_attributes_filter_spec.rb@@ -50,7 +50,7 @@ RSpec.describe Queries::Projects::Filters::AvailableProjectAttributesFilter dolet(:project_custom_field_project_mapping_handwritten_sql_subquery) do<<-SQL.squish- SELECT DISTINCT "project_custom_field_project_mappings"."project_id"+ SELECT "project_custom_field_project_mappings"."project_id"FROM "project_custom_field_project_mappings"WHERE "project_custom_field_project_mappings"."custom_field_id"IN (#{values.join(', ')})