/[cricket]/parse_pg_size.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /parse_pg_size.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sun Aug 10 11:55:06 2003 UTC (15 years, 8 months ago) by dpavlin
Branch: MAIN
File MIME type: text/plain
new monitor for number of tupels in PostgreSQL database

1 #!/usr/bin/perl -w
2
3 use strict;
4 use DBI;
5
6 my $host = shift @ARGV || '';
7 $host = ";host=$host" if ($host);
8 my $user = shift @ARGV || "dpavlin";
9 my $pass = shift @ARGV || "";
10
11 my $sql = "SELECT sum(relpages) FROM pg_class";
12
13 my $dbh = DBI->connect("DBI:Pg:dbname=template1$host",$user,$pass) || die $DBI::errstr;
14 my $sth=$dbh->prepare($sql);
15
16 if ($sth->execute()) {
17 print join("\n",$sth->fetchrow_array()),"\n";
18 }
19
20 undef $sth;
21 $dbh->disconnect();

  ViewVC Help
Powered by ViewVC 1.1.26