postgres troubleshooting

pg_dump -C -h localhost -U localuser dbname | psql -h remotehost -U remoteuser dbname

++++++++++++++++++++
\list or \l: list all databases
\dt: list all tables in the current database
You will never see tables in other databases, these tables aren't visible. You have to connect to the correct database to see its tables (and other objects).

To switch databases:

\connect database_name
src: https://dba.stackexchange.com/questions/1285/how-do-i-list-all-databases-and-tables-using-psql
--------------------------------

SELECT *
FROM   pg_trigger
WHERE  tgrelid = 'stakertech.public.blocks'::regclass;
-> tgname = 'RI_ConstraintTrigger_a_16588';
tgname = 'RI_ConstraintTrigger_a_16589';

and because of these restrictions on the blocks table deletion on condition coin_id became VERY slow.

so ALTER TABLE blocks DISABLE TRIGGER ALL;
delete ...
ALTER TABLE blocks ENABLE TRIGGER ALL;

but it's should be done by superuser(eg postgres) because triggers a system.

src: https://www.endpoint.com/blog/2012/10/25/postgres-system-triggers-error
https://stackoverflow.com/questions/25202133/how-to-get-the-triggers-associated-with-a-view-or-a-table-in-postgresql/25202347
https://stackoverflow.com/questions/34098326/how-to-select-a-schema-in-postgres-when-using-psql
https://dba.stackexchange.com/questions/37034/very-slow-delete-in-postgresql-workaround
https://gist.github.com/rgreenjr/3637525

Комментарии

Популярные сообщения из этого блога

kafka конспект однако

Дэвид Рок: Ваш мозг на работе - Разговоры в Гугле

Отслеживание Процесса загрузки с PHP и JavaScript