Minor verbosity increase for analyze

Started by Mark Kirkwoodalmost 23 years ago7 messagespatches
Jump to latest
#1Mark Kirkwood
mark.kirkwood@catalyst.net.nz

Attached is a (very small) patch to make analyze display some
interesting info in
verbose mode about the analyzed relation (pages, rows per block and rows ).

This is all available in the statistics catalog but I have found it
useful to see it appear as
you run...

mods to :

src/backend/commands/analyze.c

plain diff against current CVS (31/07/2003 NZST)

Best wishes

Mark

Attachments:

analyze.c.difftext/plain; name=analyze.c.diffDownload+6-0
#2Mark Kirkwood
mark.kirkwood@catalyst.net.nz
In reply to: Mark Kirkwood (#1)
Re: Minor verbosity increase for analyze

After browsing this list, I thought I would re-submit this in a more
standard form.

In addition I corrected a couple of things (integer cast for the number
of rows,
and capitalization in the comment)

regards

Mark

Attachments:

analyze.patchtext/plain; name=analyze.patchDownload+6-0
#3Bruce Momjian
bruce@momjian.us
In reply to: Mark Kirkwood (#2)
Re: Minor verbosity increase for analyze

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Mark Kirkwood wrote:

After browsing this list, I thought I would re-submit this in a more
standard form.

In addition I corrected a couple of things (integer cast for the number
of rows,
and capitalization in the comment)

regards

Mark

--- src/backend/commands/analyze.c.orig	2003-07-31 20:49:22.000000000 -0400
+++ src/backend/commands/analyze.c	2003-07-31 20:49:29.000000000 -0400
@@ -694,6 +694,12 @@
*/
*totalrows = floor((double) onerel->rd_nblocks * tuplesperpage + 0.5);
+	/*
+	 * Emit some interesting relation info 
+	 */
+	elog(elevel, "  pages = %d rows/page = %d rows = %.0f", 
+		onerel->rd_nblocks, (int)tuplesperpage, *totalrows);
+
return numrows;
}

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Bruce Momjian
bruce@momjian.us
In reply to: Mark Kirkwood (#1)
Re: Minor verbosity increase for analyze

Newest version of patch applied. Thanks.

---------------------------------------------------------------------------

Mark Kirkwood wrote:

Attached is a (very small) patch to make analyze display some
interesting info in
verbose mode about the analyzed relation (pages, rows per block and rows ).

This is all available in the statistics catalog but I have found it
useful to see it appear as
you run...

mods to :

src/backend/commands/analyze.c

plain diff against current CVS (31/07/2003 NZST)

Best wishes

Mark

696a697,702

/*
* emit some interesting relation info
*/
elog(elevel, " pages = %d rows/page = %d rows = %d",
onerel->rd_nblocks, (int)tuplesperpage, (int)*totalrows);

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#5Bruce Momjian
bruce@momjian.us
In reply to: Mark Kirkwood (#2)
Re: Minor verbosity increase for analyze

This was the actual patch applied.

---------------------------------------------------------------------------

Mark Kirkwood wrote:

After browsing this list, I thought I would re-submit this in a more
standard form.

In addition I corrected a couple of things (integer cast for the number
of rows,
and capitalization in the comment)

regards

Mark

--- src/backend/commands/analyze.c.orig	2003-07-31 20:49:22.000000000 -0400
+++ src/backend/commands/analyze.c	2003-07-31 20:49:29.000000000 -0400
@@ -694,6 +694,12 @@
*/
*totalrows = floor((double) onerel->rd_nblocks * tuplesperpage + 0.5);
+	/*
+	 * Emit some interesting relation info 
+	 */
+	elog(elevel, "  pages = %d rows/page = %d rows = %.0f", 
+		onerel->rd_nblocks, (int)tuplesperpage, *totalrows);
+
return numrows;
}

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Mark Kirkwood
mark.kirkwood@catalyst.net.nz
In reply to: Mark Kirkwood (#2)
Re: Minor verbosity increase for analyze

Found some bugs with this patch - that makes it about 1 per line
patched... :-(

i) onerel->rd_nblocks should be elog'ed as an unsigned int.
ii) acquire_sample_rows has 2 return points - I had ignored the case
where the
onerel has < sample size tuples in it.

Attachments:

analyze.patchtext/plain; name=analyze.patchDownload+4-1
#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mark Kirkwood (#6)
Re: Minor verbosity increase for analyze

Mark Kirkwood <markir@paradise.net.nz> writes:

Found some bugs with this patch - that makes it about 1 per line
patched... :-(

i) onerel->rd_nblocks should be elog'ed as an unsigned int.
ii) acquire_sample_rows has 2 return points - I had ignored the case
where the
onerel has < sample size tuples in it.

I've applied a variant of this.

regards, tom lane