[Rt-commit] rt branch 5.0/split-fulltext-searches updated. rt-5.0.5-152-g49a487417a

BPS Git Server git at git.bestpractical.com
Fri Feb 2 13:35:54 UTC 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/split-fulltext-searches has been updated
       via  49a487417a1d484c9ad2b0d3f17d3bebf934c802 (commit)
       via  fd78575ff814b739f7a239efe992e89213d73196 (commit)
      from  bce33fe8a423ca0fbef395606340f545c497621a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 49a487417a1d484c9ad2b0d3f17d3bebf934c802
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Feb 2 08:15:34 2024 -0500

    Bump database version requirements for the full support of INTERSECT/UNION SQL
    
    MySQL 5.7 and MariaDB 10.3 have reached EOF anyway.

diff --git a/README.md b/README.md
index e44b7fcafe..796997be2c 100644
--- a/README.md
+++ b/README.md
@@ -15,8 +15,8 @@ RT is commercially-supported software. To purchase hosting, support, training, c
     - RT won't start on versions of Perl older than 5.10.1.
 
 - A supported SQL database
-   - MySQL 5.7, 8 with InnoDB support
-   - MariaDB 10.2 or later with InnoDB support
+   - MySQL 8.0.31 or later with InnoDB support
+   - MariaDB 10.4 or later with InnoDB support
    - Postgres 9.5 or later
    - Oracle 12c or later
    - SQLite 3.0 or later (for testing only, no upgrade path guaranteed)

commit fd78575ff814b739f7a239efe992e89213d73196
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Feb 2 08:07:24 2024 -0500

    Wrap SQL with another SELECT to avoid DEPENDENT UNION/SUBQUERY
    
    Recent versions of MySQL/MariaDB SQL optimizer may rewrite IN clauses as
    correlated subqueries(EXPLAIN ... shows DEPEDENT UNION/SUBQUERY), which
    slows down the split SQL a lot.
    
    This commit gets around this negative optimization by adding an extra wrap.

diff --git a/lib/RT/SearchBuilder.pm b/lib/RT/SearchBuilder.pm
index 78844ccdfe..c7b9991cfd 100644
--- a/lib/RT/SearchBuilder.pm
+++ b/lib/RT/SearchBuilder.pm
@@ -1212,7 +1212,12 @@ sub _BuildQuery {
     my $method = shift;
     if ( my $query = $self->{_split_query} ) {
         my $objects = $self->new( $self->CurrentUser );
-        $objects->Limit( FIELD => 'id', VALUE => "($query)", OPERATOR => 'IN', QUOTEVALUE => 0 );
+        if ( RT->Config->Get('DatabaseType') eq 'mysql' ) {
+            $objects->Limit( FIELD => 'id', VALUE => "(SELECT * from ($query) AS T)", OPERATOR => 'IN', QUOTEVALUE => 0 );
+        }
+        else {
+            $objects->Limit( FIELD => 'id', VALUE => "($query)", OPERATOR => 'IN', QUOTEVALUE => 0 );
+        }
 
         # Sync page and columns related info
         $objects->{$_} = $self->{$_} for qw/first_row show_rows columns/;

-----------------------------------------------------------------------

Summary of changes:
 README.md               | 4 ++--
 lib/RT/SearchBuilder.pm | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list