OpenSolaris 2008.11 and PostgreSQL 8.3
The second supported version of OpenSolaris called OpenSolaris 2008.11 is now officially launched. With the release, I guess now PostgreSQL 8.3 is now "officially" supported on OpenSolaris too (though you could have used it prior anyway with the development releases of OpenSolaris after the initial OpenSolaris 2008.05 was released).
Anyway let's quickly look at some tips and how-to which I think could be useful to improve the experience of PostgreSQL 8.3 with OpenSolaris 2008.11. One way to take a quick drive of OpenSolaris 2008.11 is to also try out the new VirtualBox 2.0.6 and install OpenSolaris 2008.11 in a VM. (Note: If you do plan to access the VM from other systems then use Host Interface instead of NAT to make it easy to access it from outside.)
PostgreSQL 8.3 is not already installed once you install OpenSolaris 2008.11 from the LiveCD. This gives an opportunity for a tweak that I would highly recommend. By default OpenSolaris 2008.11 does not have option for separate ZFS dataset for /var (like Solaris 10 10/08 - U6 does). I would certainly like my PostgreSQL database to be on a separate dataset that I can control PostgreSQL snapshots independently. Since I know the default PostgreSQL database path for PostgreSQL 8.3 on OpenSolaris is /var/postgres/8.3 I generally create a separate dataset as follows before I use pkg script to install PostgreSQL 8.3
# zfs create -o mountpoint=/var/postgres rpool/postgres
Now I am ready to install the various packages of PostgreSQL 8.3
# pkg install SUNWpostgr-83-server
# pkg install SUNWpostgr-83-client SUNWpostgr-jdbc SUNWpostgr-83-contrib
# pkg install SUNWpostgr-83-docs SUNWpostgr-83-devel
# pkg install SUNWpostgr-83-tcl SUNWpostgr-83-pl
Now to install PGAdmin3 as follows:
# pkg install SUNWpgadmin3
Even pgbouncer is available in the repository
# pkg install SUNWpgbouncer-pg83
Now that all binaries are installed, let's look on how to get started. Generally the best way to start and stop PostgreSQL 8.3 server is via the svcadm command of OpenSolaris. The SMF manifest for PostgreSQL 8.3 is installed with SUNWpostgr-83-server, however the import of the script does not happen till the next reboot. We can always work that around by doing a quick manual update as follows:
# svccfg import /var/svc/manifest/application/database/postgresql_83.xml
This creates two entries one for 32-bit server instance and one for 64-bit server instance.
# svcs -a |grep postgres
disabled 1:14:44 svc:/application/database/postgresql_83:default_64bit
disabled 1:14:45 svc:/application/database/postgresql_83:default_32bit
Depending on your server/choice you can start the corresponding server. Or 32-bit instance may be just easier to select if there are doubts.
# svcadm enable postgresql_83:default_32bit
# svcs -a |grep postgres
disabled 1:14:44 svc:/application/database/postgresql_83:default_64bit
online 2:12:37 svc:/application/database/postgresql_83:default_32bit
# zfs list rpool/postgres
NAME USED AVAIL REFER MOUNTPOINT
rpool/postgres 30.4M 11.8G 30.4M /var/postgres
The client psql is still not in the default path. The path /usr/postgres/8.3/bin should be in your search PATH. (or if you are using 64-bit add /usr/postgres/8.3/bin/64).
# /usr/postgres/8.3/bin/psql -U postgres postgresWelcome to psql 8.3.4, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
postgres=#
For people who are using PostgreSQL 8.2 on OpenSolaris 2008.05 already, there is a way to get to PostgreSQL 8.3. First you have to update your OpenSolaris 2008.05 to OpenSolaris 2008.11 image using
# pkg image-update
Then install PostgreSQL 8.3 binaries as above and also install an additional package
# pkg install SUNWpostgr-upgrade
If there are more question feel free to leave a comment.

Does this Postgresql package contain DTrace probes?
Posted by Mikael Gueck on December 11, 2008 at 05:36 PM EST #
Hi Mikael,
Yes it does.
http://wikis.sun.com/display/DBonSolaris/DBDTraceProbes
-Jignesh
Posted by Jignesh Shah on December 11, 2008 at 08:00 PM EST #
In which cases would you recommend tracing the database client library calls amidst the other client side calls, and in which cases would you recommend using the database probes? Can you easily connect the library calls to the database probe trips?
Posted by Mikael Gueck on December 12, 2008 at 01:21 AM EST #
Shouldn't we also be fiddling the ZFS block size for postgres data and log volumes, or is that no longer applicable? Or something that has to be deferred to file creation?
Posted by James Mansion on December 16, 2008 at 04:28 AM EST #
Hi,
Sorry I just want to know how can I configure my PATH in order to every time I turn on the computer this PATH of postgres will be configured.
I HAve OpenSolaris 2008.11 with Postgres 8.3
Thanks,
Oscar
Posted by Oscar Jabin on March 27, 2009 at 09:58 PM EDT #
Hi Oscar,
Do you want to set the path for your user?
In that case you need to set the following in $HOME/.profile
PATH=/usr/postgres/8.3/bin:$PATH; export PATH
(Or if you are using 64 bit version then)
PATH=/usr/postgre/8.3/bin/amd64:$PATH; export PATH
If you want to set it for all users then you need to set it in
/etc/profile
Is this what you are looking for? Hope this helps
Posted by Jignesh Shah on March 28, 2009 at 10:42 AM EDT #
what are they intended to
# pkg install SUNWpgadmin3
# pkg install SUNWpgbouncer-pg83
?
Posted by usuario on May 07, 2009 at 06:12 PM EDT #