Duplicate Rows in a primary key Table.

Back again, getting very less time for blogging 🙂 “ERROR: could not create unique indexDETAIL: Table contains duplicated values.” This error is thrown out by Postgres when it encounters duplicate rows in a primary key table by failing any of these command REINDEX or CREATE UNIQUE INDEX. Why duplicate rows exists in a table ?…

Londiste Replication with PostgreSQL 9.0

Londiste, Asynchronous Master/Slave replication tool developed by Skytools. Its very simple and user-friendly created like Slony. Core logic behind Londiste or Slony is Remote Triggering. Whereas londiste follows events queuing model which is not their in Slony – I. Overview on Skytools:Skytools is a Python-based application, it comes with a bundle of three things PgQ,Londiste…

Resize VARCHAR column of a Large Tables

Note: Recommended not to tamper pg_catalogs. On forum, I saw an interesting posting and also the solution, however few things of that solution made me to test it. Scenario is, “How to resize the VARCHAR column on a large table with less time and what are best  approach’s”. As known standard way is to, Create…

Deadlocks in PostgreSQL

Before discussing on deadlocks, lets see type of locks and their acquiring methodolgy in PostgreSQL.Types of Locks: Table-Level Locks and Row-Level Locks Table-Level Locks: AcessShareLock : It acquired automatically by a SELECT statement on the table or tables it retrieves from. This mode blocks ALTER TABLE, DROP TABLE, and  VACUUM (AccessExclusiveLock) on the same table RowShareLock…

~/.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…