postgresql

Postgresql

 
psql -h 192.168.1.100 -p 5432 -U u1 mydatabase
 
 
import psycopg2
conn = psycopg2.connect("host='10.59.1.50' dbname='DB' user='perm' password='perm'")

Star stop init db create databases

  • pg_config –configure - как скомпилирован Postgres

psql - cheatsheet

Sql.interesting sql

SQL check version/size

Find objects and fields

SQL check database data

SQL List index

SQL check database index - amcheck verify tbl b-tree Indexes

SQL generate database data

SQL json examples

Загрузка управления и обработка

SQL.COPY load from DB

SQL.COPY load data to DB

Describe of admin tasks

  • Check configuration files - select sourcefile, name,sourceline,error from pg_file_settings where error is not null;
  • Check config of authorization in postgresqland pg_hba SHOW password_encryption;SELECT * FROM pg_hba_file_rules();

Bloat - MVCC - transaction - Get current xmin - PageInspector

Get ddl dump for table

Situation with Invalid page header encountered: blockNo 0, path .... base/16384/923678

  • debian
localedef -i ru_RU -c -f UTF-8 -A /usr/share/locale/locale.alias ru_RU.utf8
export LANG=ru_RU.utf8

Users manipulation

dependencies - pg_depend get info

dependencies - pg_depend Hierarchies

dependencies - pg_depend Recursive Hierarchies - объекты ссылающиеся на объект исследования

PG_rewrite / PG_constraint details

extensions / function - get list of function

Partition - get info

Partition - Example creation

Partition - Auto create partition

Резервное копирование pg_dump и pg_restore

SQL pg_dump/pg_restore

Wal-g.Backup статьи

Wal-g.Backup резервного копирования

Backup Порядок действий и инструкции

WAL-G.restore восстановление

Walg restore восстановление

  • postgresql.txt
  • Last modified: 2024/08/04 02:07
  • by admin