Quantcast
Channel: AI Rumman with the Systems
Browsing all 27 articles
Browse latest View live

pg_restore error with invalid input syntax for integer: "U" and out of memory

I was trying to restore a 6 Gb database in my development machine which is running on Centos 5.6 with memory 1 GB.The postgresql.conf was like :shared_memory = 128 MBmaintenance_work_mem = 300...

View Article



Remove log files using Python in Windows Server

I was working in Windows Server 2003 where one of our application service was creating a large log files every day and when the  log file used to become more than 2 GB the application rotate it to...

View Article

Rank Functions

RANK(), DENSE_RANK() and ROW_NUMBER() are three important reporting functions in Postgresql. These are also used in Oracle.RANKRetuns unique serial number for each row, except for rows that have...

View Article

Python Virtual Environment Setup

I had to install python 2.7 for an application where I did not want to change the default configuration of Python 2.4. That's why I choose to use vurtualenv. virtualenv is a virtual python environment...

View Article

Steps to upgrade Postgresql database using pg_upgrade

I had  to upgrade Postgresql 9.0 to 9.2 with less downtime. Earlier I used to complete this kind of upgrade work using pg_dump. But as I have very little downtime for 60 GB database, I chose to go with...

View Article


Postgresql function to check a value is number

In Postrgesql, I created a function to check a column value is number or not. Its a simple function.CREATE OR REPLACE FUNCTION is_number(prm_str text) RETURNS BOOLEAN AS $$DECLARE  v_return...

View Article

Rsync with filter for specific subdirectory

I have to ensure a backup of our document folders. The structure is /DOC/company1//DOC/company2/.../DOC/companyN/In each /DOC/companyN/ folder, we had some files and folders...

View Article

Postgresql Query Parallelizing with dblink

I have three tables with almost 10 millions of records in each. The tables are:customer accounttickets"customer" table holds record for all kind of customers which are related to account or tickets.We...

View Article


Postgresql type casting information using pg_cast

Query to Postgresql type casting information:SELECT ct.*,source_t.typname as source_type,target_t.typname as target_type, proc.pronameFROMpg_cast as ct, pg_type as source_t, pg_type as target_t,pg_proc...

View Article


Postgresql dynamic crosstab function

Postgresql 9.0 has a contrib module named tablefunc which provide crosstab functionality.http://www.postgresql.org/docs/9.1/static/tablefunc.htmlIt has two types of crosstab functions :- crosstab(text...

View Article

Insert records instead of delete to reclaim space of a large table

A few days back, I got a task to reclaim space for a database server by deleting a good number of records from a table. It was at Postgresql 9.1.Initially, the developers planned to delete the rows and...

View Article

Nagios to Check Postgresql Least Vacuum Time

Nagios is one of the finest tools to monitor system. We use it in our environment to monitor all our systems like databases, application servers, services etc. check_postgres is one of the tools to...

View Article

Nagios Script to find unused databases

I created to nagios script to find out unused databases in our data centers. It gives us an alert like :    ***** Nagios *****    CRITICAL: 4 unused database(s) found at 0.0.0.0:5432 that were last...

View Article


Postgresql 9.2 Streaming Replication Setup

Node 1 : 10.0.1.46Node 2: 10.0.1.56i) Prepare Node 1: 1. Check postgresqls running with the following parameters:listen_addresses = '*'wal_level = hot_standbymax_wal_senders = 5wal_keep_segments =...

View Article

Postgresql Radius Based Search using Latitude and Longitude for a Zip Code

We have a table called "image_info" as follows. We have to find the images that are nearest to a given zip code. \d image_info                                    Table "public.image_info"      Column...

View Article


Generate pgbadger report from minimal information

I was working for a client who was experiencing slowness in his application and I need to find out if it was database related.He provided me some data of query logs in a table generated by application...

View Article

Postgresql online space reclaim using pg_repack

Working with the Postgresql databases, often we hear the term table bloat and index bloat. Postgresql uses MVCC technology, for which deleted or updated rows remain in the table and it creates index...

View Article


pgHA - Postgresql+Pgbouncer High Availability Tools

I was working on a project to setup easy failover system for Postgresql Master-Slave replication where all app servers were connected to the dbserver through pgbouncer. I had to configure such a...

View Article

Wordpress Import Blogs From Production to Development Environment

We have a wordpress blog environment for a school sports portal where every state, league, school and team has their own blog. We have almost 160000 blogs in the system so far and which is growing....

View Article

Postgresql schema sizes

In order to get schema sizes of a large database, I used the following sql:select schemaname, pg_size_pretty(sum(pg_table_size(schemaname||'.'||relname))::bigint) as sfrom pg_stat_user_tablesgroup by...

View Article
Browsing all 27 articles
Browse latest View live




Latest Images