This is an very common and well understood problem. Take a look at this: http://www.varlena.com/GeneralBits/130.php
-- Regards, Peter Geoghegan -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general