Bug 24488: perf - Group by at DBMS level

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-11-18 10:42:39 +01:00
parent 83944dc232
commit 774d4e9ab4
1 changed files with 3 additions and 4 deletions

View File

@ -185,11 +185,10 @@ if ( C4::Context->preference('IndependentBranches') ){
}
# get all distinct unfulfilled reserves
my $distinct_holds = Koha::Holds->search(
my @biblionumbers = Koha::Holds->search(
{ %where },
{ join => 'itembib', alias => 'reserve', columns => [ 'biblionumber' ] }
);
my @biblionumbers = uniq $distinct_holds->get_column('biblionumber');
{ join => 'itembib', alias => 'reserve', distinct => 1, columns => qw[me.biblionumber] }
)->get_column('biblionumber');
my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 });
my @waiting_holds = map { $_->itemnumber } Koha::Holds->search({'found' => 'W'}, { columns => [ 'itemnumber' ], collapse => 1 });