Issue index filtering with custom field became unusable with Redmine 4.2.7
When running an issue query with a custom field used on filtering, the query result that used to take about 72ms now takes 85652ms, rendering the page unusable on Redmine 4.2.7.
Reverting this change https://github.com/redmine/redmine/commit/00c1e3528f09a1b83ef7bdf0f3d231de4dff9450 or even only reverting the issue_custom_field.rb change (removing issue visibility condition) makes the performance like 4.2.6. See the attached logs for details. Note that the custom field 105 in this example is a boolean issue custom field, but this issue does not seem to be related to the type of the custom field.
sh: hg: command not found sh: bzr: command not found Environment: Redmine version 4.2.7.stable Ruby version 2.7.6-p219 (2022-04-12) [x86_64-linux] Rails version 5.2.8 Environment production Database adapter PostgreSQL Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Subversion 1.14.1 Cvs 1.12.13 Git 2.35.3 Filesystem Redmine plugins: no plugin installed
Using Postgresql 14.4 but note that this is reproducable on different environments with (minor) different versions of Postgresql Ruby etc.