Is it possible to run Postgres 8.4 AND 9 at the same time (two installations)?
Thank you
Is it possible to run Postgres 8.4 AND 9 at the same time (two installations)?
Thank you
Short answer: yes
Long answer:
You didn't specify your OS, so it's difficult to say how to do it. For example in Debian/Ubuntu you can just install second version from package (postgresql-8.4
and postgresql-9.0
) and everything works out of the box (thanks to postgresql-common). On other systems you probably need to do it manually using "low level" commands such initdb and pg_ctl. Make sure that second installation (database cluster) uses different port (for example 5433) and not same data directory.
Yes, provided the following three preconditions are satisfied:
pgbouncer
and you can probably hide both copies of PostgreSQL behind a single IP/port and reduce your memory footprint by reducing the number of active connections)PGDATA
directories.I can't recommend using pgbouncer
enough.
On Windows you don't need to do anything as the installer automatically creates unique data directories and detects an existing installation and adjusts the ports automatically.
For example - your first installation will listen on 5432 and your second installation will listen on 5433, as the installer configures this for you.
You always can, the question is how hard it will be to install two versions at the same time, and that depends on your operating system. On RedHat Linux derived systems for example, this is very hard to do. The PostgreSQL RPM packages are only intended to have a single version installed at any one time. Sometimes the only reasonable way to proceed is to build your own PostgreSQL from source for the second version you want to install, which is an interesting adventure if you've never done it before.
On Debian Linux two versions at once is pretty easy. I believe it's straightforward on Windows too, but it may depend on which installer you are using.
Once you get two different versions of the database installed, only then do you have to worry about the things everyone else is talking about: making each database run on its own port and have its own installation directory. Those are often trivial compared with the work it takes to get two versions installed at once though.
Yes you can. You'll need to run them on different ports and use different data directories.
The port and data directory can both be set in postgresql.conf.
There are I believe several other ways of specifying the data directory including using the PGDATA environment variable.