psql client can be a chess board now...

Yes, pgChess extension now allows you to play a chess game with Postgres Instance(computer). Thanks to authors. Installation is very simple with pgxnclient. pgChess extension supported with another extension called pg2podg. Documentation Link: https://github.com/gciolli/pgChess/blob/master/doc/ pgxnclient install pgchess pgxnclient install pg2podg After installing, just run CREATE EXTENSION commands create extension pgchess; create extension pg2podg; Two types of play, (1) PC vs PC and (2) PC vs Human. To play a new game of PC vs Human run below file (download source from the above link for the files) in unaligned format of psql terminal.

Continue reading →

PAGER setting in windows for psql client

psql is a great tool. Oftentimes, output of the particular command in psql is too big to fit on one screen, hence outputs are wrapped to fit in one screen which becomes output unreadable. To custommize command output in readable format we have system variable called PAGER. If its on linux, I can simply set PAGER variable with LESS command + options to view command ouptut in readable format. Eg:-

Continue reading →

~/.psqlrc file for DBA's

In our regular DBA monitoring, we will be using so many combination of pg_catalog queries to reteive information like <IDLE> in transaction , waiting queries, No. of connections, etc. Most of the DBA’s, create views to cut short big combination queries and keep handy for later use per requirement. PostgreSQL, provides a startup file(.psqlrc) which executes before connecting to the database when using with psql utility. Using .psqlrc file you can place all your important queries with one word alias by ‘\set’ command and execute it in psql terminal instead of typing big queries.

Continue reading →