[Rt-commit] rt branch 5.0/specify-addl-ticket-transaction-join-criteria created. rt-5.0.3-255-g6d6dd6b7d4

BPS Git Server git at git.bestpractical.com
Fri Feb 24 20:45:12 UTC 2023

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/specify-addl-ticket-transaction-join-criteria has been created
        at  6d6dd6b7d4fa7e47b2bf3c9b41910bdbc9d59b97 (commit)

- Log -----------------------------------------------------------------
commit 6d6dd6b7d4fa7e47b2bf3c9b41910bdbc9d59b97
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Fri Feb 17 15:38:12 2023 -0500

    Add JOIN criteria for transaction searches
    Transaction searches cannot use the existing index on the transactions
    table if ObjectType is not provided. Adding ObjectType to the join
    greatly improves the performance of transaction searches, especially for
    RT databases with large numbers of transactions.

diff --git a/lib/RT/Transactions.pm b/lib/RT/Transactions.pm
index 6ee5697bb4..6e9ac03324 100644
--- a/lib/RT/Transactions.pm
+++ b/lib/RT/Transactions.pm
@@ -1111,9 +1111,9 @@ sub _JoinTickets {
     unless ( defined $self->{_sql_aliases}{tickets} ) {
         $self->{_sql_aliases}{tickets} = $self->Join(
             TYPE   => 'LEFT',
-            FIELD1 => 'ObjectId',
             TABLE2 => 'Tickets',
             FIELD2 => 'id',
+            EXPRESSION => "main.ObjectId AND main.ObjectType='RT::Ticket'",
     return $self->{_sql_aliases}{tickets};



More information about the rt-commit mailing list