Browse Source

Bug 29579: Show saved SQL report ID in database query

When trying to figure out which saved SQL report caused too much load,
it's useful to have the report id show in the mysql process list.

This patch adds the saved SQL ID number as a comment line in front
of the SQL before passing it to the database.

To test:
1) Run a saved report that takes long enough time, so you can:
2) Connect to the database with your preferred client, and use
   "show processlist;" to list all the running mysql processes.
3) The running saved SQL report should show up with
   "-- saved_sql.id=123" in the process info field.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
22.05.x
Pasi Kallinen 3 years ago
committed by Fridolin Somers
parent
commit
39ec12fc48
  1. 1
      C4/Reports/Guided.pm

1
C4/Reports/Guided.pm

@ -593,6 +593,7 @@ sub execute_query {
$dbh->do( 'UPDATE saved_sql SET last_run = NOW() WHERE id = ?', undef, $report_id ) if $report_id;
$sql = "-- saved_sql.id=$report_id\n" . $sql;
my $sth = $dbh->prepare($sql);
eval {
$sth->execute(@$sql_params, $offset, $limit);

Loading…
Cancel
Save