[Rt-commit] rt branch, 5.0/oracle-exact-query-hint, created. rt-5.0.1-333-gec070d25ac
Jim Brandt
jbrandt at bestpractical.com
Mon May 10 11:53:56 EDT 2021
The branch, 5.0/oracle-exact-query-hint has been created
at ec070d25aca6f2e81d1f918411ac6faec2bf0aee (commit)
- Log -----------------------------------------------------------------
commit ec070d25aca6f2e81d1f918411ac6faec2bf0aee
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon May 10 11:52:49 2021 -0400
Add hint to use exact cursor sharing for FromSQL queries on Oracle
Oracle can run with CURSOR_SHARING set to multiple values
including force and exact. RT can run better when running
with force, but this can cause issues with poor performance
on certain ad hoc queries like those generated by the
query builder.
Add a hint for these queries to use exact.
diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
index 95410282df..624f8c8134 100644
--- a/share/html/Elements/CollectionList
+++ b/share/html/Elements/CollectionList
@@ -56,10 +56,12 @@ if (!$Collection) {
$Query = join ' AND ', @limits;
}
$Collection->FromSQL($Query);
+ $Collection->QueryHint("+CURSOR_SHARING_EXACT") if RT->Config->Get('DatabaseType') eq 'Oracle';
}
elsif (!$Collection && $Class eq 'RT::Assets') {
$Collection = RT::Assets->new( $session{'CurrentUser'} );
$Collection->FromSQL($Query);
+ $Collection->QueryHint("+CURSOR_SHARING_EXACT") if RT->Config->Get('DatabaseType') eq 'Oracle';
}
# flip HasResults from undef to 0 to indicate there was a search, so
diff --git a/share/html/Search/Results.html b/share/html/Search/Results.html
index 3bfbb66142..115c225a61 100644
--- a/share/html/Search/Results.html
+++ b/share/html/Search/Results.html
@@ -196,8 +196,11 @@ $session{$hash_name} = {
ObjectType => $ObjectType,
};
-
-my $count = $session{$session_name}->Query() ? $session{$session_name}->CountAll() : 0;
+my $count = 0;
+if ( $session{$session_name}->Query() ) {
+ $count = $session{$session_name}->CountAll();
+ $session{$session_name}->QueryHint("+CURSOR_SHARING_EXACT") if RT->Config->Get('DatabaseType') eq 'Oracle';
+}
my $title;
if ( $Class eq 'RT::Transactions' ) {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list