PostgreSQL Commands
TRUNCATE vs DELETE vs DROP: Remove Rows Fast in PostgreSQL
Jun 16, 2026 / · 8 min read · postgresql database administration sql queries truncate delete maintenance postgres dba ·TRUNCATE vs DELETE vs DROP: Remove Rows Fast in PostgreSQL Where DELETE removes rows one logical version at a time and leaves the cleanup to vacuum, TRUNCATE discards an entire table's contents almost instantly and reclaims the space immediately, and DROP removes the table itself. Picking the wrong one for "empty this …
Read MoreHow Many Connections Can Your PostgreSQL Database Handle?
Mar 18, 2024 / · 7 min read · show postgresql database performance optimization pg_stat_activity pg_settings pg_stat_database pg_database pg_roles ·How Many Connections Can Your PostgreSQL Database Handle? PostgreSQL 16 split the connection limit into more than one pool. Besides the slots held back for superusers, a second block of slots can now be reserved for ordinary roles that have been granted pg_use_reserved_connections. The number of sessions an application …
Read MoreImporting Data into an Existing PostgreSQL Database Managing your PostgreSQL database often involves importing data from backups or external sources. This post explores a simple yet effective command-line approach to achieve this: psql -d anexistingdb -f dump.sql. We'll break down its components, explain its …
Read MoreBacking Up a Remote PostgreSQL Database with pg_dump The database lives on a managed host three networks away, the only backup is whatever the provider snapshots, and nobody has ever tried to restore from it. A logical dump taken from a laptop or a jump box fixes that in one command, because pg_dump is an ordinary …
Read More