Project

General

Profile

Defect #38788 ยป fix-slow-query-of-has-been-opr.patch

Go MAEDA, 2023-06-28 06:37

View differences:

app/models/query.rb
1458 1458
          " AND " +
1459 1459
          queried_class.send(:sanitize_sql_for_conditions, ["#{JournalDetail.table_name}.old_value IN (?)", value.map(&:to_s)]) +
1460 1460
          ")"
1461
        if %w[ev !ev].include?(operator)
1462
          subquery <<
1461
        sql_ev =
1462
          if %w[ev !ev].include?(operator)
1463 1463
            " OR " + queried_class.send(:sanitize_sql_for_conditions, ["#{db_table}.#{db_field} IN (?)", value.map(&:to_s)])
1464
        end
1465
        sql = "#{neg} EXISTS (#{subquery})"
1464
          else
1465
            ''
1466
          end
1467
        sql = "#{neg} (EXISTS (#{subquery})#{sql_ev})"
1466 1468
      else
1467 1469
        sql = '1=0'
1468 1470
      end
    (1-1/1)