POSTGRES DB SCRIPTS

DATABASE INFO
Create a database in postgres
How to connect to postgres db
Drop database in postgres
Find the database details in postgres
Find postgres db sizes
How to find timezone info
How to find postgres version
How to enable archiving(wal) in postgres
How to rotate server log in postgres
Find query execution time using pg_stat_statement
How to find data directory location
Find current sessions in postgres
Kill a session in postgres
Kill all session of a user in postgres
Find locks present in postgres
Find blocking sessions in postgres
Find location of postgres conf files
Find current data/time on postgres db
Find foreign server details
Find extension details
Find startup time and uptime postgres
Find archiver process status
Find the last pg config reload time

OBJECT MANAGEMENT
Create/drop table in postgres
Find list of schemas in postgres
Find schema wise size in postgres db
Find top 10 big tables in postgres
Find tables and its index sizes
List down index details in postgres
Find list of foreign tables
Find specific table/index size
Find the size of a column
Find respective physical file of a table/index


MAINTENANCE
Update statistics of a table using analyze
Reorg a table using VACUUM command
Reorg a table using VACUUM FULL command
Manage autovacuum process in postgres
Rebuild indexes using REINDEX
Monitor index creation or rebuild
Monitor vacuum operation

USER MANAGEMENT
List users present in postgres
List roles present in postgres
create/drop user in postgres
Create/drop role in postgres
Alter an user in postgres
Convert a user to superuser
Set password to original one without knowing
GRANT privilege commands
REVOKE privilege commands
Create user profile - EDB Postgres
Create/Drop schema in postgres
Find search_path setting of users
Set search_path of a user in postgres


TABLESPACE MANAGEMENT
View tablespace info in postgres
create/drop/rename tablespace in postgres
find/change default tablespace
find/change default temp tablespace

BACKUP & RECOVERY
export table data to file using COPY


AUDITING & SECURITY
Find pg_hba.conf file content
Enable auditing for ddl/dml statement
Enable audit for log on/log off to postgres

NETWORK

-
- This page will be updated regularly with new scripts.Please provide suggestions to improve this page.
Keep visiting us.
Thank you very much ,
Scripts stopped opening
Dear, This has been fixed. Please let me know if you are still facing issue?
Regards
Admin