There is two commands to kill query
Soft kill: pg_cancel_backend(pid)
Hard kill pg_terminate_backend(pid)
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
# delete first echo for real results | |
for file in *; do echo mv "$file" "$(echo $file | sed 's/ - /_/g ; s/ /-/g')" ; done |
#!/usr/bin/env python | |
import os | |
from shutil import move | |
translation_table = { | |
"А": "A", | |
"а": "a", | |
"Б": "B", | |
"б": "b", |
There is two commands to kill query
Soft kill: pg_cancel_backend(pid)
Hard kill pg_terminate_backend(pid)
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
SELECT
pid,
now() - pg_stat_activity.query_start AS duration,
query,
state
FROM pg_stat_activity
WHERE query like '%<condition>%' AND (now() - pg_stat_activity.query_start) > interval '5 minutes';
> .mode csv
> .import file_name.csv table_name
list(zip(*original[::-1]))
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;