http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=2898 Summary: C4::Letters::parseletter kills performance in notice jobs Product: Koha Version: HEAD Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P3 Component: Notices AssignedTo: henridamien@koha-fr.org ReportedBy: joe.atzberger@liblime.com QAContact: koha-bugs@lists.koha.org parseletter() gets called 4 times for each non-digest notice. Each call does one "show columns..." and one query from the following: if ( $table eq 'biblio' ) { $sth = $dbh->prepare("select * from biblio where biblionumber=?"); } elsif ( $table eq 'biblioitems' ) { $sth = $dbh->prepare("select * from biblioitems where biblionumber=?"); } elsif ( $table eq 'items' ) { $sth = $dbh->prepare("select * from items where itemnumber=?"); } elsif ( $table eq 'reserves' ) { $sth = $dbh->prepare("select * from reserves where borrowernumber = ? and biblionumber=?"); } elsif ( $table eq 'borrowers' ) { $sth = $dbh->prepare("select * from borrowers where borrowernumber=?"); } elsif ( $table eq 'branches' ) { $sth = $dbh->prepare("select * from branches where branchcode=?"); } elsif ( $table eq 'aqbooksellers' ) { $sth = $dbh->prepare("select * from aqbooksellers where id=?"); } At the very least, the show columns call should be cached in a hash by tablename. They will not be changing at runtime. Also, the biblio SELECT queries should be more, um... selective and not pull the large marc and marxml fields, which would not be useful to notice jobs anyway. An else clause should be added to the end of the block above to explicitly die if some *other* tablename is referenced, since the job is about to die anyway when it goes to execute an unprepared $sth. Overall, some other process for getting most of this information should be considered. It is really unnecessary to go requery each table individually 4 times for each pending notice when the same data could be retrieved at the outset from a properly JOINed query. ------- You are receiving this mail because: ------- You are the QA contact for the bug, or are watching the QA contact.