How can I get my server's uptime?
Use the built-in function pg_postmaster_start_time
select current_timestamp - pg_postmaster_start_time() as uptime
More details in the manual: http://www.postgresql.org/docs/current/static/functions-info.html
If you want seconds, use extract
:
select extract(epoch from current_timestamp - pg_postmaster_start_time()) as uptime