Skip site navigation (1) Skip section navigation (2)

Re: 2 postgresql processes on the same machine ?

From: Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de>
To: jeanguillaume(dot)lalanne(at)capgemini(dot)com (Jean-Guillaume LALANNE)
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: 2 postgresql processes on the same machine ?
Date: 2004-07-29 16:45:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Jean-Guillaume LALANNE wrote:
 > My question may seem a little bit strange but
 > I'd like to know if it is possible to run 2
 > postgresql processes with 2 separate databases on the 
 > same machine (change of the ports, different paths to 
 > logs, ...)?

It's possible (I've done it in the past), but I would not
recommend it.

If you don't need network connectivity (i.e. access the
database only locally), then there is no problem at all.
If you need network connectivity, you can run the two
(or more) instances of PostgreSQL on different ports,
or you can bind them to different IP addresses if your
host has multiple ones.  (Note, PostgreSQL also uses a
UDP port on localhost to exchange statistics information,
but the port number is selected randomly, so there is no

However, in general it is not advisable to run multiple
database services (no matter if it's PostgreSQL or any
other) on the same physical machine.  That's because the
processes will fight against each other for hardware
resources such as processor cache, disk cache, I/O band-
width etc.  In the worst case, both processes constantly
trow each other out of the cache, effectively disabling
it (this effect is called "trashing").

If you run just one PostgreSQL master, it uses shared
memory to communicate with its child processes and use
efficient caching between them.  If you run two (or more)
separate PostgreSQL masters, they cannot share any data
between each other.

In general, it is better to buy two cheaper machines than
to try to run two separate database services on one big
machine, expecially if you expect significant load on the
databases.  At least that has been my experience.  YMMV.

Best regards

Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 M√ľnchen
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

cat man du : where Unix geeks go when they die

In response to

pgsql-novice by date

Next:From: Scott MarloweDate: 2004-07-29 17:45:04
Subject: Re: trying to run a query
Previous:From: Tom LaneDate: 2004-07-29 14:51:29
Subject: Re: Moving DB von Postgresql 7.3 to 7.4

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group