First of all, you need to backup all your company databases followed by an upgrade of your PostgreSQL installation. There are plenty of places on the web to explain how to do that. The high-level process is to install the two versions in parallel and run the pg_upgradecluster command.
When the technical upgrade has succeeded, however, you're not ready to see the performance improvements promised by the 8.4+ versions of PostgreSQL with respect to the menu-generation. This is because the database doesn't automatically use the new 8.4+ code definitions.
To take advantage of the performance improvements of 8.4+, you'll need to re-run setup.pl on all your company databases. With each of the databases, you can clean up after having run setup.pl: the tablefunc contrib is no longer required, meaning you can
psql -U ledgersmb -d -f /uninstall_tablefunc.sql
On my own database I needed to run the above command three times to make it stop reporting "ERROR: Can't DROP because other objects depend on it." (On each round the number of other errors increased: on each round the number of objects successfully being dropped increased.)
That should do it. You should have a clean 8.4+ PostgreSQL database with LedgerSMB.