#define TABLE_STATS_QUERY "select a.oid,a.relname,a.relnamespace,a.relpages,a.relisshared,a.reltuples,b.schemaname,b.n_tup_ins,b.n_tup_upd,b.n_tup_del from pg_class a, pg_stat_all_tables b where a.oid=b.relid and a.relkind = 'r' and schemaname not like 'pg_temp_%'"
#define FRONTEND
#define TABLE_STATS_QUERY "select a.oid,a.relname,a.relnamespace,a.relpages,a.relisshared,a.reltuples,b.schemaname,b.n_tup_ins,b.n_tup_upd,b.n_tup_del from pg_class a, pg_stat_all_tables b where a.oid=b.relid and a.relkind = 'r'"
#define PAGES_QUERY "select oid,reltuples,relpages from pg_class where oid=%u"
#define FROZENOID_QUERY "select oid,age(datfrozenxid) from pg_database where datname = 'template1'"
#define FROZENOID_QUERY2 "select oid,datname,age(datfrozenxid) from pg_database where datname!='template0'"
...
...
@@ -44,6 +46,16 @@
/* define atooid */
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
/* Log levels */
enum
{
LVL_DEBUG=1,
LVL_INFO,
LVL_WARNING,
LVL_ERROR,
LVL_EXTRA
};
/* define cmd_args stucture */
structcmdargs
{
...
...
@@ -51,18 +63,28 @@ struct cmdargs
analyze_base_threshold,
sleep_base_value,
debug,
#ifndef WIN32
daemonize;
#else
install_as_service,
remove_as_service;
#endif
floatvacuum_scaling_factor,
analyze_scaling_factor,
sleep_scaling_factor;
char*user,
*password,
#ifdef WIN32
*service_user,
*service_password,
#endif
*host,
*logfile,
*port;
};
typedefstructcmdargscmd_args;
/* define cmd_args as global so we can get to them everywhere */
cmd_args*args;
...
...
@@ -106,6 +128,9 @@ struct tableinfo
};
typedefstructtableinfotbl_info;
/* The main program loop function */
staticintVacuumLoop(intargc,char**argv);
/* Functions for dealing with command line arguements */