Bug 28922 - Vendor search has poor performance when system has many vendors
Summary: Vendor search has poor performance when system has many vendors
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
: 11215 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-08-30 14:24 UTC by Nick Clemens (kidclamp)
Modified: 2023-07-11 08:39 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2021-08-30 14:24:29 UTC
In acquisitions our search does a 'contains' search on vendor name

We then loop through the vendors and lookup the baskets

We then lookup the groups for each basket we found

It would be nice if we could fetch all the info needed in one call to the DB
and possibly add paging
Comment 1 Jonathan Druart 2021-09-01 13:49:47 UTC
How many is many? 100, 1000, 10000?
Comment 2 Kyle M Hall (khall) 2021-09-01 13:50:21 UTC
(In reply to Jonathan Druart from comment #1)
> How many is many? 100, 1000, 10000?

Depends on the hardware.
Comment 3 Jonathan Druart 2021-09-01 13:58:45 UTC
(In reply to Kyle M Hall from comment #2)
> (In reply to Jonathan Druart from comment #1)
> > How many is many? 100, 1000, 10000?
> 
> Depends on the hardware.

Lol yes, I know, but it's good to have an idea to recreate the problem locally.
Comment 4 Katrin Fischer 2023-07-08 22:07:54 UTC
*** Bug 11215 has been marked as a duplicate of this bug. ***
Comment 5 Kyle M Hall (khall) 2023-07-10 11:47:25 UTC
(In reply to Jonathan Druart from comment #3)
> (In reply to Kyle M Hall from comment #2)
> > (In reply to Jonathan Druart from comment #1)
> > > How many is many? 100, 1000, 10000?
> > 
> > Depends on the hardware.
> 
> Lol yes, I know, but it's good to have an idea to recreate the problem
> locally.

This will do it:

#!/usr/bin/perl
use t::lib::TestBuilder;
my $builder = t::lib::TestBuilder->new;

for ( my $i = 0; $i < 100; $i++ ) {
    my $b = $builder->build({ source => 'Aqbookseller' });
    for ( my $i = 0; $i < 100; $i++ ) {
        my $basket = $builder->build({ source => 'Aqbasket', value  => { booksellerid => $b->{id} } });
    }
}