
How to Kill Long Running Queries From the Shell Step by Step
Kill long running queries from the shell: find them in pg_stat_activity or the MySQL process list, cancel before terminate and prevent repeats.
Dumps, restores, ad-hoc queries and safe data moves for MySQL, PostgreSQL and SQLite from the terminal.

Kill long running queries from the shell: find them in pg_stat_activity or the MySQL process list, cancel before terminate and prevent repeats.

Check database size from the shell in PostgreSQL, MySQL, SQLite and Redis: database and table sizes, indexes, the largest objects and a script for trends.

Find slow queries from the command line: pg_stat_statements and the log in PostgreSQL, the slow query log and mysqldumpslow in MySQL, then EXPLAIN.

Query large CSV, JSON and Parquet files with the DuckDB command line: no import step, glob many files, summarize, export and set memory limits.

Run SQL on CSV files from the terminal with csvsql and q, or plain sqlite3: queries, type inference traps, joins across files and output formats.

Analyze logs with SQLite from the shell: parse lines into a table, import, add indexes, run top-N and time bucket queries, and know when awk is enough.

Use SQLite as a local store for shell scripts: create tables idempotently, insert and query safely, handle concurrent runs with WAL and timeouts, and back up.

Use redis-cli for quick checks and scripts: connect safely, inspect keys with scan, read INFO and slowlog and avoid KEYS and MONITOR in production.

Query JSON columns from the shell in PostgreSQL, MySQL and SQLite: extract fields, filter, expand arrays, return clean output for scripts and pipe rows to jq.

Dump and restore a database in Docker: pg_dump and mysqldump via docker exec, volume backups, consistency, restoring into a new container and speed.

Point in time recovery restores a database to a chosen moment: base backups plus archived logs, a PostgreSQL setup, and when you need it.

Logical versus physical database backups: what each contains, speed, portability, consistency, restore options and which to use for small and large databases.
One email when a new post is published. No spam.