Skip to Main Content
PostgreSQL 9 Administration Cookbook - Second Edition
book

PostgreSQL 9 Administration Cookbook - Second Edition

by Simon Riggs, GIANNI CIOLLI, Hannu Krosing, Gabriele Bartolini
April 2015
Intermediate to advanced content levelIntermediate to advanced
504 pages
11h 41m
English
Packt Publishing
Content preview from PostgreSQL 9 Administration Cookbook - Second Edition

Killing a specific session

Sometimes, the only way to let the system continue as a whole is by surgically terminating some offending database sessions. Yes, you read it right—surgically. You might indeed be tempted to reboot the server, but you should think of that as a last resort in a business continuity scenario.

In this recipe, you will be learning how to intervene, from gracefully canceling a query to brutally killing the actual process from the command line.

How to do it…

You can either run this function as a superuser or, when using PostgreSQL 9.2 or newer versions, with the same user as that of the offending backend (look for the usename field in the pg_stat_activity view).

Once you have figured out the backend you need to kill, use the function ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PostgreSQL 10 Administration Cookbook - Fourth Edition

PostgreSQL 10 Administration Cookbook - Fourth Edition

Simon Riggs, Gianni Ciolli
Mastering PostgreSQL 10

Mastering PostgreSQL 10

Hans-Jürgen Schönig

Publisher Resources

ISBN: 9781849519069Supplemental Content