Find database creation date

We cannot find it directly but we can check attributes of directories which contain data files of each database. In PostgreSQL you can try this query: with mydir as (select setting||'/base' as _dir from pg_settings where name = 'data_directory'), mydbs as (select oid...

Parallel run of queries / functions / tasks using dblink

PostgreSQL has one problem which limits scalability. One process / session / connection can use only one CPU / core. Therefore if you want / need to run several queries / tasks / functions in parallel you have to use dblink functions to open more parallel connections...

Find comments on database objects

If you need to check which of your objects have comments you can use this select: select ns.nspname as schema_name, c.relname as table_name, a.attname as column_name, d.description as "comment" from pg_description d join pg_class c on d.objoid=c.oid join...

Find dependecies for some object

PostgreSQL can show you directly only these dependencies: table – view table column – view view – view view column – view …   You cannot check directly dependencies like: table (view) -> function table (view) column -> function...

All pg_catalog objects in PostgreSQL 9.3 with explanation

Table is still in TODO… Name TypeExplanationReturnsTags pg_advisory_lockprocedureObtain (create) exclusive advisory lockvoidlock pg_advisory_lock_sharedprocedureObtain (create) shared advisory lockvoidlock pg_advisory_unlockprocedureReleases exclusive advisory...

Analyze data file

So far I did not find any tool which could help me to analyze content of some table’s data file. And sometimes it is really useful even necessary to see what was in deleted records. Therefore I tried to decode data file using program in python. Simple version is...