Skip to content

Commit

Permalink
PDO: Use index hint for source_update_needed only if a source filter …
Browse files Browse the repository at this point in the history
…is specified.
  • Loading branch information
EreMaijala committed Jan 10, 2024
1 parent 4732023 commit 393e563
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/RecordManager/Base/Database/PDODatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ protected function getIndexHints(string $collection, array $filter, array $optio
if (!$this->useIndexHints || !$this->isMySQLCompatible()) {
return '';
}
if ('record' === $collection && isset($options['sort']['_id'])) {
if ('record' === $collection && isset($options['sort']['_id']) && isset($filter['source_id'])) {
return 'USE INDEX (source_update_needed)';
}
return '';
Expand Down

0 comments on commit 393e563

Please sign in to comment.