HomeEvergreen: Basic System Admin FunctionsReporter IssuesKill Reports or Database Processes politely

2.3. Kill Reports or Database Processes politely

   >>>killing database processes politely<<<
   This is particularly useful for killing runaway reports.  Note that this is an email from Miker.
             ----------------snip----------------
       First, find the bad report:
       evergreen=# select now()-query_start,procpid,current_query from
         pg_stat_activity where current_query <> '<IDLE>';
                     ?column?     | procpid |                                                                                                              
       current_query                                                                                                               
       -----------------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        00:00:00        |   24373 | select now()-query_start,procpid,current_query
       from pg_stat_activity where current_query <> '<IDLE>';
        06:00:12.664521 |   19681 |
       SELECT\x09"6b89db56fc7d830b621fe56999f87eba"."shortname" AS "Library Short
       (Policy) Name",
                                  :
       \x09"7fb66fd46f5581428d27fcd56ad5c85f"."circ_modifier" AS "Circulation
       Modifier",
                                  : \x09EXTRACT(YEAR FROM
       "6531077d9eb1b14d8147b82f2ffd1d6f"."checkin_time") || '-' || LPAD(EXTRACT(MONTH
       FROM "6531077d9eb1b14d8147b82f2ffd1d6f"."checkin_time"),2,'0') AS "Circulation
       -> Check In Library -> Checkins -> Check In Date/Time",
                                  :
       \x09COUNT("fce458da5814089639960610c48d19d2"."id") AS "Count"
                                  :   FROM\x09action.circulation AS
       "fce458da5814089639960610c48d19d2"
                                  : \x09INNER JOIN actor.org_unit AS
       "5ba72c6d4ac452a3221b0782d5e85614" ON
       ("fce458da5814089639960610c48d19d2"."checkin_lib" =
       "5ba72c6d4ac452a3221b0782d5e85614"."id")
                                  : \x09LEFT OUTER JOIN action.circulation AS
       "6531077d9eb1b14d8147b82f2ffd1d6f" ON ("5ba72c6d4ac452a3221b0782d5e85614"."id"
       = "6531077d9eb1b14d8147b82f2ffd1d6f"."checkin_lib")
                                  : \x09INNER JOIN asset.copy AS
       "7fb66fd46f5581428d27fcd56ad5c85f" ON
       ("fce458da5814089639960610c48d19d2"."target_copy" =
       "7fb66fd46f5581428d27fcd56ad5c85f"."id")
                                  : \x09INNER JOIN
       (2 rows)

       The second query is the baddy ... so:

       evergreen=# select pg_cancel_backend(19681);

       pg_cancel_backend
       -------------------
        t
       (1 row)

       ?
       ----------------snip----------------

This page was: Helpful | Not Helpful