Skip to content

Latest commit

 

History

History
55 lines (32 loc) · 2.82 KB

File metadata and controls

55 lines (32 loc) · 2.82 KB

Maintain

Main administration

sudo systemctl restart postgresql  # restart postgresql service

Inside database

\d - list databases
\c db_name - connect to a database

Creating a copy of a database in PostgreSQL - Stack Overflow List all databases and tables using psql? - Database Administrators Stack Exchange

SQL syntaxes

-- VIEWS
CREATE OR REPLACE view name AS SELECT ...;

SELECT CAST('10C' AS INTEGER); -- BOOLEAN, DATE, DOUBLE, VARCHAR, ...

Backup / Restore

How to restore PostgreSQL database from .tar file? - Server Fault What if the Backup Server Is Down and a Backup Is Needed? (Multi-repo Functionality of PgBackRest) Full vs. Incremental vs. Differential Backups: Comparing Backup Types What To Do When a Data File in PostgreSQL Goes Missing

Exporting http://www.pgadmin.org/docs/1.18/export.html

Export a CREATE script for a database - Stack Overflow

Misc

Remove extended characters in string http://stackoverflow.com/questions/15259622/how-do-i-remove-extended-ascii-characters-from-a-string-in-t-sql
Replace string in field http://stackoverflow.com/questions/5060526/postgresql-replace-all-instances-of-a-string-within-text-field
Replace ASCII to UTF8 http://www.laudatio.com/wordpress/2008/11/05/postgresql-83-to_ascii-utf8/

Postgres to sqlite convert https://stackoverflow.com/questions/6148421/how-to-convert-a-postgres-database-to-sqlite

PostgreSQL, MonetDB, and Too-Big-for-Memory Data in R -- Part II http://www.datasciencecentral.com/xn/detail/6448529:BlogPost:733154

Find the WAL Count Between Two Segments in PostgreSQL