]> git.koha-community.org Git - koha.git/commit
Bug 13740: Remove the NOT NULL clause in GetBorrowersToExpunge
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 20 Feb 2015 15:23:50 +0000 (16:23 +0100)
committerChris Cormack <chris@bigballofwax.co.nz>
Fri, 3 Apr 2015 03:34:04 +0000 (16:34 +1300)
commit7d6fe812e48a9cb941f827ae1e1794e4d0ea4dd1
treec2a15c098784d3fa2abf80c4b1292c5c263445d4
parent09c9f8549bbd10a95a99dc1ae3f6e9fd7930231f
Bug 13740: Remove the NOT NULL clause in GetBorrowersToExpunge

C4::Borrowers::GetBorrowersToExpunge should not use a "NOT IN", it is
not efficient at all.

With only 1 guarantor and more than 136k patrons, the not in clause in
this subroutine takes ages:
mysql> select count(*) FROM   borrowers where  borrowernumber NOT IN
(SELECT guarantorid FROM borrowers WHERE guarantorid IS NOT NULL AND
guarantorid <> 0) ;
[...]

not ended after 5min

With the query modified by this patch, the results come after 1 sec :)

Test plan:
Verify the delete_patrons.pl cronjob or the cleanborrowers tools work as
before.
Especially with guarantors.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit b721b6f9f3b8eb65a929ca0605216b58f8f87996)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
C4/Members.pm