https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43208 Bug ID: 43208 Summary: When searching action logs incorrectly formatted timestamps can slow responses Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com Target Milestone: --- Observed in production on a site with many rows in action logs, searching using the filters can take a long time. Testing the query on the command line I noticed it was fast if I used correct mySQL timestamps, however, the query took over a minute when the timestamps were formatted like 2026-07-31T00:00:00Z Below is the query I got from dumping the resultset as a query, it took over a minute to run, then if I correct the timestamp it takes seconds (SELECT `me`.`action_id`, `me`.`timestamp`, `me`.`user`, `me`.`module`, `me`.`action`, `me`.`object`, `me`.`info`, `me`.`interface`, `me`.`script`, `me`.`trace`, `me`.`diff`, `librarian`.`borrowernumber`, `librarian`.`cardnumber`, `librarian`.`surname`, `librarian`.`firstname`, `librarian`.`preferred_name`, `librarian`.`middle_name`, `librarian`.`title`, `librarian`.`othernames`, `librarian`.`initials`, `librarian`.`pronouns`, `librarian`.`streetnumber`, `librarian`.`streettype`, `librarian`.`address`, `librarian`.`address2`, `librarian`.`city`, `librarian`.`state`, `librarian`.`zipcode`, `librarian`.`country`, `librarian`.`email`, `librarian`.`phone`, `librarian`.`mobile`, `librarian`.`fax`, `librarian`.`emailpro`, `librarian`.`phonepro`, `librarian`.`B_streetnumber`, `librarian`.`B_streettype`, `librarian`.`B_address`, `librarian`.`B_address2`, `librarian`.`B_city`, `librarian`.`B_state`, `librarian`.`B_zipcode`, `librarian`.`B_country`, `librarian`.`B_email`, `librarian`.`B_phone`, `librarian`.`dateofbirth`, `librarian`.`branchcode`, `librarian`.`categorycode`, `librarian`.`dateenrolled`, `librarian`.`dateexpiry`, `librarian`.`password_expiration_date`, `librarian`.`date_renewed`, `librarian`.`gonenoaddress`, `librarian`.`lost`, `librarian`.`debarred`, `librarian`.`debarredcomment`, `librarian`.`contactname`, `librarian`.`contactfirstname`, `librarian`.`contacttitle`, `librarian`.`borrowernotes`, `librarian`.`relationship`, `librarian`.`sex`, `librarian`.`password`, `librarian`.`secret`, `librarian`.`auth_method`, `librarian`.`flags`, `librarian`.`userid`, `librarian`.`opacnote`, `librarian`.`contactnote`, `librarian`.`sort1`, `librarian`.`sort2`, `librarian`.`altcontactfirstname`, `librarian`.`altcontactsurname`, `librarian`.`altcontactaddress1`, `librarian`.`altcontactaddress2`, `librarian`.`altcontactaddress3`, `librarian`.`altcontactstate`, `librarian`.`altcontactzipcode`, `librarian`.`altcontactcountry`, `librarian`.`altcontactphone`, `librarian`.`smsalertnumber`, `librarian`.`sms_provider_id`, `librarian`.`privacy`, `librarian`.`privacy_guarantor_fines`, `librarian`.`privacy_guarantor_checkouts`, `librarian`.`checkprevcheckout`, `librarian`.`updated_on`, `librarian`.`lastseen`, `librarian`.`lang`, `librarian`.`login_attempts`, `librarian`.`overdrive_auth_token`, `librarian`.`anonymized`, `librarian`.`autorenew_checkouts`, `librarian`.`primary_contact_method`, `librarian`.`protected`, `patron`.`borrowernumber`, `patron`.`cardnumber`, `patron`.`surname`, `patron`.`firstname`, `patron`.`preferred_name`, `patron`.`middle_name`, `patron`.`title`, `patron`.`othernames`, `patron`.`initials`, `patron`.`pronouns`, `patron`.`streetnumber`, `patron`.`streettype`, `patron`.`address`, `patron`.`address2`, `patron`.`city`, `patron`.`state`, `patron`.`zipcode`, `patron`.`country`, `patron`.`email`, `patron`.`phone`, `patron`.`mobile`, `patron`.`fax`, `patron`.`emailpro`, `patron`.`phonepro`, `patron`.`B_streetnumber`, `patron`.`B_streettype`, `patron`.`B_address`, `patron`.`B_address2`, `patron`.`B_city`, `patron`.`B_state`, `patron`.`B_zipcode`, `patron`.`B_country`, `patron`.`B_email`, `patron`.`B_phone`, `patron`.`dateofbirth`, `patron`.`branchcode`, `patron`.`categorycode`, `patron`.`dateenrolled`, `patron`.`dateexpiry`, `patron`.`password_expiration_date`, `patron`.`date_renewed`, `patron`.`gonenoaddress`, `patron`.`lost`, `patron`.`debarred`, `patron`.`debarredcomment`, `patron`.`contactname`, `patron`.`contactfirstname`, `patron`.`contacttitle`, `patron`.`borrowernotes`, `patron`.`relationship`, `patron`.`sex`, `patron`.`password`, `patron`.`secret`, `patron`.`auth_method`, `patron`.`flags`, `patron`.`userid`, `patron`.`opacnote`, `patron`.`contactnote`, `patron`.`sort1`, `patron`.`sort2`, `patron`.`altcontactfirstname`, `patron`.`altcontactsurname`, `patron`.`altcontactaddress1`, `patron`.`altcontactaddress2`, `patron`.`altcontactaddress3`, `patron`.`altcontactstate`, `patron`.`altcontactzipcode`, `patron`.`altcontactcountry`, `patron`.`altcontactphone`, `patron`.`smsalertnumber`, `patron`.`sms_provider_id`, `patron`.`privacy`, `patron`.`privacy_guarantor_fines`, `patron`.`privacy_guarantor_checkouts`, `patron`.`checkprevcheckout`, `patron`.`updated_on`, `patron`.`lastseen`, `patron`.`lang`, `patron`.`login_attempts`, `patron`.`overdrive_auth_token`, `patron`.`anonymized`, `patron`.`autorenew_checkouts`, `patron`.`primary_contact_method`, `patron`.`protected` FROM `action_logs` `me` LEFT JOIN `borrowers` `librarian` ON `librarian`.`borrowernumber` = `me`.`user` LEFT JOIN `borrowers` `patron` ON `patron`.`borrowernumber` = `me`.`object` WHERE ( ( ( `module` = 'CRONJOBS' AND ( `timestamp` <= '2026-07-31T23:59:59Z' AND `timestamp` >= '2026-07-31T00:00:00Z' ) ) AND ( `me`.`timestamp` LIKE '%renew%' OR `me`.`user` LIKE '%renew%' OR `me`.`module` LIKE '%renew%' OR `me`.`action` LIKE '%renew%' OR `me`.`object` LIKE '%renew%' OR `me`.`info` LIKE '%renew%' OR `me`.`interface` LIKE '%renew%' ) ) ) ORDER BY `me`.`timestamp` DESC LIMIT 20); -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.