Temporarily Disable PostgreSQL Triggers
To temporarily disable all triggers in a PostgreSQL session, use this:
SET session_replication_role = replica;
That disables all triggers for the current database session only. Useful for bulk operations, but remember to be careful to keep your database consistent.
To re-enable:
SET session_replication_role = DEFAULT;
Disable a Single Trigger
To disable just …
Checking PostgreSQL Disk Usage
This query sums total disk space used by the table including indexes and toasted data for the 20 largest tables:
SELECT nspname || '.' || relname AS "relation", pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND …