On Wed, 2004-02-11 at 16:25, Bruce Momjian wrote:
> 
> Sure, shoot them over to hackers or patches.  The pg_autovacuum author
> is looking into this.

Here they are. They've worked well for me, but someone wiser in the ways
of C should certainly look them over. :)


? autovac.patch
? pg_autovacuum
Index: pg_autovacuum.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/contrib/pg_autovacuum/pg_autovacuum.c,v
retrieving revision 1.13
diff -u -r1.13 pg_autovacuum.c
--- pg_autovacuum.c	8 Dec 2003 21:54:00 -0000	1.13
+++ pg_autovacuum.c	12 Feb 2004 00:25:57 -0000
@@ -118,7 +118,7 @@
 	new_tbl->curr_vacuum_count = new_tbl->CountAtLastVacuum;
 
 	new_tbl->relid = atoi(PQgetvalue(res, row, PQfnumber(res, "oid")));
-	new_tbl->reltuples = atoi(PQgetvalue(res, row, PQfnumber(res, "reltuples")));
+	new_tbl->reltuples = atof(PQgetvalue(res, row, PQfnumber(res, "reltuples")));
 	new_tbl->relpages = atoi(PQgetvalue(res, row, PQfnumber(res, "relpages")));
 
 	if (strcmp("t", PQgetvalue(res, row, PQfnumber(res, "relisshared"))))
@@ -159,7 +159,7 @@
 		if (res != NULL)
 		{
 			tbl->reltuples =
-				atoi(PQgetvalue(res, 0, PQfnumber(res, "reltuples")));
+				atof(PQgetvalue(res, 0, PQfnumber(res, "reltuples")));
 			tbl->relpages = atoi(PQgetvalue(res, 0, PQfnumber(res, "relpages")));
 
 			/*
@@ -363,7 +363,7 @@
 	log_entry(logbuffer);
 	sprintf(logbuffer, "     relid: %i;   relisshared: %i", tbl->relid, tbl->relisshared);
 	log_entry(logbuffer);
-	sprintf(logbuffer, "     reltuples: %i;  relpages: %i", tbl->reltuples, tbl->relpages);
+	sprintf(logbuffer, "     reltuples: %.0f;  relpages: %i", tbl->reltuples, tbl->relpages);
 	log_entry(logbuffer);
 	sprintf(logbuffer, "     curr_analyze_count:  %li; cur_delete_count:   %li",
 			tbl->curr_analyze_count, tbl->curr_vacuum_count);
Index: pg_autovacuum.h
===================================================================
RCS file: /projects/cvsroot/pgsql-server/contrib/pg_autovacuum/pg_autovacuum.h,v
retrieving revision 1.8
diff -u -r1.8 pg_autovacuum.h
--- pg_autovacuum.h	1 Dec 2003 23:19:33 -0000	1.8
+++ pg_autovacuum.h	12 Feb 2004 00:25:57 -0000
@@ -84,10 +84,12 @@
 {
 	char	   *schema_name,
 			   *table_name;
-	int			relid,
-				reltuples,
-				relisshared,
-				relpages;
+	unsigned int	relid,
+			relpages;
+
+	int		relisshared;
+	double		reltuples;
+
 	long		analyze_threshold,
 				vacuum_threshold;
 	long		CountAtLastAnalyze;		/* equal to: inserts + updates as
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to