Database Reference
In-Depth Information
How it works...
Postgres stores the server start time, so we can access it directly as follows:
postgres=# SELECT pg_postmaster_start_time();
pg_postmaster_start_time
───────────────────────────────
2009-11-26 09:39:23.354208+00
then we can do some SQL to get the uptime as follows:
postgres=# SELECT current_timestamp - pg_postmaster_start_time();
?column?
────────────────
00:35:30.22868
and then do some formatting, such as:
postgres=# SELECT date_trunc('second',
current_timestamp - pg_postmaster_start_time()) as uptime;
uptime
──────────
00:38:15
See Also
This is just simple stuff. Further monitoring and statistics are covered in later chapters.
Locate the database server files
Database server files are initially stored in a location referred to as the data directory .
Additional data files may also be stored in tablespaces , if any exist.
Getting ready
You'll need to get an operating system access to the database system, which is what
we call the platform on which the database runs.
How to do it...
On Debian or Ubuntu systems, the default data directory location is as follows:
F /var/lib/postgresql/R.r/main
 
Search WWH ::




Custom Search