Skip to content

Instantly share code, notes, and snippets.

@mawaldne
mawaldne / postgres_queries_and_commands.sql
Last active March 3, 2021 21:11 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (9.2)
SELECT pid, client_addr, age(clock_timestamp(), query_start), usename, query, state
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query
/* ~/Library/KeyBindings/DefaultKeyBinding.dict */
{
/*
* Keybindings for emacs emulation.
*
* WARNING! After Mountain Lion, this file cannot be symbolic linked to another file,
* you need to put this file in ~/Library/KeyBindings/DefaultKeyBinding.dict directly
*
* Reference: