stats_block_level

Started by Simon Riggsover 18 years ago30 messageshackers
Jump to latest
#1Simon Riggs
simon@2ndQuadrant.com

Why is stats_block_level = off by default?

Is there a measurable cost to enabling this? We already have
stats_row_level = on, so presumably the overhead of setting
stats_block_level to on cannot be any worse than that.

Anybody got any objection to setting it on by default?

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Simon Riggs (#1)
Re: stats_block_level

"Simon Riggs" <simon@2ndquadrant.com> writes:

Anybody got any objection to setting it on by default?

Yes. It's pure overhead with no redeeming social value except to those
who actually want to look at that sort of stat, and those who do can
certainly turn it on for themselves.

regards, tom lane

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#2)
Re: stats_block_level

I wrote:

"Simon Riggs" <simon@2ndquadrant.com> writes:

Anybody got any objection to setting it on by default?

Yes. It's pure overhead with no redeeming social value except to those
who actually want to look at that sort of stat, and those who do can
certainly turn it on for themselves.

On second thought ... the cost of incrementing n_blocks_read etc is
certainly negligible. The overhead comes from sending messages to the
collector, having the collector maintain table entries, writing those
entries out to a file, etc. And AFAICS all that overhead is expended
per table: if you touch a relation during a transaction, the ensuing
costs are identical no matter whether you have stats_block_level or
stats_row_level or both turned on.

Furthermore, it seems pretty likely that a transaction that creates any
row-level counts for a table will also create block-level counts, and
vice versa.

So maybe the *real* question to ask is why we have separate GUCs for
stats_row_level and stats_block_level. Shouldn't we fold them into a
single switch? It's hard to see what having just one of them turned on
will save.

regards, tom lane

#4Dave Page
dpage@pgadmin.org
In reply to: Tom Lane (#3)
Re: stats_block_level

Tom Lane wrote:

So maybe the *real* question to ask is why we have separate GUCs for
stats_row_level and stats_block_level. Shouldn't we fold them into a
single switch? It's hard to see what having just one of them turned on
will save.

Any reason not to just fold them both into stats_start_collector ?

Regards, Dave.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dave Page (#4)
Re: stats_block_level

Dave Page <dpage@postgresql.org> writes:

Tom Lane wrote:

So maybe the *real* question to ask is why we have separate GUCs for
stats_row_level and stats_block_level. Shouldn't we fold them into a
single switch? It's hard to see what having just one of them turned on
will save.

Any reason not to just fold them both into stats_start_collector ?

Well, then you couldn't turn collection on and off without restarting
the postmaster, which might be a pain.

regards, tom lane

#6Satoshi Nagayasu
nagayasus@nttdata.co.jp
In reply to: Tom Lane (#3)
Re: stats_block_level

Tom,

Yes. It's pure overhead with no redeeming social value except to those
who actually want to look at that sort of stat, and those who do can
certainly turn it on for themselves.

I think the stats stuff should be on by default even if it causes
some performance penalty.

Because when we have performance problems on the production system,
it needs more performance penalty (about 5%~) to measure the stats
by turning their params on.

In real scenario, we always need the performance information,
so we always need to turn. So I want the performance information
can be taken by default.

Just my thought.

Tom Lane wrote:

I wrote:

"Simon Riggs" <simon@2ndquadrant.com> writes:

Anybody got any objection to setting it on by default?

Yes. It's pure overhead with no redeeming social value except to those
who actually want to look at that sort of stat, and those who do can
certainly turn it on for themselves.

On second thought ... the cost of incrementing n_blocks_read etc is
certainly negligible. The overhead comes from sending messages to the
collector, having the collector maintain table entries, writing those
entries out to a file, etc. And AFAICS all that overhead is expended
per table: if you touch a relation during a transaction, the ensuing
costs are identical no matter whether you have stats_block_level or
stats_row_level or both turned on.

Furthermore, it seems pretty likely that a transaction that creates any
row-level counts for a table will also create block-level counts, and
vice versa.

So maybe the *real* question to ask is why we have separate GUCs for
stats_row_level and stats_block_level. Shouldn't we fold them into a
single switch? It's hard to see what having just one of them turned on
will save.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

--
NAGAYASU Satoshi <nagayasus@nttdata.co.jp>
Phone: +81-50-5546-2496

#7Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#3)
Re: stats_block_level

Tom Lane wrote:

I wrote:

"Simon Riggs" <simon@2ndquadrant.com> writes:

Anybody got any objection to setting it on by default?

Yes. It's pure overhead with no redeeming social value except to those
who actually want to look at that sort of stat, and those who do can
certainly turn it on for themselves.

On second thought ... the cost of incrementing n_blocks_read etc is
certainly negligible. The overhead comes from sending messages to the
collector, having the collector maintain table entries, writing those
entries out to a file, etc. And AFAICS all that overhead is expended
per table: if you touch a relation during a transaction, the ensuing
costs are identical no matter whether you have stats_block_level or
stats_row_level or both turned on.

Furthermore, it seems pretty likely that a transaction that creates any
row-level counts for a table will also create block-level counts, and
vice versa.

So maybe the *real* question to ask is why we have separate GUCs for
stats_row_level and stats_block_level. Shouldn't we fold them into a
single switch? It's hard to see what having just one of them turned on
will save.

Agreed. Jan had a tendency to add more GUCs than needed "just in case",
but usually "case" never happened.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Satoshi Nagayasu (#6)
Re: stats_block_level

Satoshi Nagayasu <nagayasus@nttdata.co.jp> writes:

I think the stats stuff should be on by default even if it causes
some performance penalty.

Because when we have performance problems on the production system,
it needs more performance penalty (about 5%~) to measure the stats
by turning their params on.

In real scenario, we always need the performance information,
so we always need to turn. So I want the performance information
can be taken by default.

I don't really agree with this argument. I've been reading
pgsql-performance for some years now, and I can't recall any incident
whatsoever in which we asked somebody for their stats_block_level
numbers. To be honest I think those numbers are just about useless.

However, in the current state of the system it seems to be nearly
free to collect them if we are collecting row-level stats, and since
that's happening by default as of 8.3, it's probably worth simplifying
the user-visible behavior by collecting both sets of stats if we collect
either.

regards, tom lane

#9Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#5)
Re: stats_block_level

Tom Lane wrote:

Any reason not to just fold them both into stats_start_collector ?

Well, then you couldn't turn collection on and off without restarting
the postmaster, which might be a pain.

Maybe we don't actually need stats_start_collector, but instead we start
it always and just have one knob to turn collection on and off. I'm
not sure whether the extra process would bother people if they're not
collecting, but we have so many extra processes now, why would anyone
care.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#10Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Peter Eisentraut (#9)
Re: stats_block_level

Peter Eisentraut wrote:

Tom Lane wrote:

Any reason not to just fold them both into stats_start_collector ?

Well, then you couldn't turn collection on and off without restarting
the postmaster, which might be a pain.

Maybe we don't actually need stats_start_collector, but instead we start
it always and just have one knob to turn collection on and off. I'm
not sure whether the extra process would bother people if they're not
collecting, but we have so many extra processes now, why would anyone
care.

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

Having a single idle process is not a problem to anyone. It just sleeps
all the time. We are all used to having six useless getty processes and
nobody cares.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#11Simon Riggs
simon@2ndQuadrant.com
In reply to: Alvaro Herrera (#10)
Re: stats_block_level

On Fri, 2007-07-27 at 04:29 -0400, Alvaro Herrera wrote:

Peter Eisentraut wrote:

Tom Lane wrote:

Any reason not to just fold them both into stats_start_collector ?

Well, then you couldn't turn collection on and off without restarting
the postmaster, which might be a pain.

Maybe we don't actually need stats_start_collector, but instead we start
it always and just have one knob to turn collection on and off. I'm
not sure whether the extra process would bother people if they're not
collecting, but we have so many extra processes now, why would anyone
care.

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

Having a single idle process is not a problem to anyone. It just sleeps
all the time. We are all used to having six useless getty processes and
nobody cares.

Yes, thats a great plan.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

#12Dave Page
dpage@pgadmin.org
In reply to: Simon Riggs (#11)
Re: stats_block_level

Simon Riggs wrote:

On Fri, 2007-07-27 at 04:29 -0400, Alvaro Herrera wrote:

Peter Eisentraut wrote:

Tom Lane wrote:

Any reason not to just fold them both into stats_start_collector ?

Well, then you couldn't turn collection on and off without restarting
the postmaster, which might be a pain.

Maybe we don't actually need stats_start_collector, but instead we start
it always and just have one knob to turn collection on and off. I'm
not sure whether the extra process would bother people if they're not
collecting, but we have so many extra processes now, why would anyone
care.

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

Having a single idle process is not a problem to anyone. It just sleeps
all the time. We are all used to having six useless getty processes and
nobody cares.

Yes, thats a great plan.

It gets my vote.

/D

#13Simon Riggs
simon@2ndQuadrant.com
In reply to: Dave Page (#12)
Re: stats_block_level

On Fri, 2007-07-27 at 10:15 +0100, Dave Page wrote:

Simon Riggs wrote:

On Fri, 2007-07-27 at 04:29 -0400, Alvaro Herrera wrote:

Peter Eisentraut wrote:

Tom Lane wrote:

Any reason not to just fold them both into stats_start_collector ?

Well, then you couldn't turn collection on and off without restarting
the postmaster, which might be a pain.

Maybe we don't actually need stats_start_collector, but instead we start
it always and just have one knob to turn collection on and off. I'm
not sure whether the extra process would bother people if they're not
collecting, but we have so many extra processes now, why would anyone
care.

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

Having a single idle process is not a problem to anyone. It just sleeps
all the time. We are all used to having six useless getty processes and
nobody cares.

Yes, thats a great plan.

It gets my vote.

Look to -patches for an implementation of the above.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

#14Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Tom Lane (#3)
Re: stats_block_level

On Jul 26, 2007, at 2:03 PM, Tom Lane wrote:

So maybe the *real* question to ask is why we have separate GUCs for
stats_row_level and stats_block_level. Shouldn't we fold them into a
single switch? It's hard to see what having just one of them
turned on
will save.

IIRC, the guys at Emma have seen a performance difference with
stats_block_level off and row_level on, presumable due in part to
having 150k tables.

Erik? Kim?
--
Jim Nasby jim@nasby.net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

#15Erik Jones
erik@myemma.com
In reply to: Jim Nasby (#14)
Re: stats_block_level

On Jul 27, 2007, at 6:45 PM, Jim Nasby wrote:

On Jul 26, 2007, at 2:03 PM, Tom Lane wrote:

So maybe the *real* question to ask is why we have separate GUCs for
stats_row_level and stats_block_level. Shouldn't we fold them into a
single switch? It's hard to see what having just one of them
turned on
will save.

IIRC, the guys at Emma have seen a performance difference with
stats_block_level off and row_level on, presumable due in part to
having 150k tables.

Erik? Kim?

Well, we turned it off at the same time we moved from 8.2.3 to 8.2.4
so the actual culprit may have been what prompted the stats collector
improvement that went into that release. I could test turning it
back on this week if you like -- I certainly would like to have my
blks_read/cach_hits stats back. Toggling stats_block_level will
respond to a reload, yes?

Software Developer | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com

#16Tom Lane
tgl@sss.pgh.pa.us
In reply to: Erik Jones (#15)
Re: stats_block_level

Erik Jones <erik@myemma.com> writes:

improvement that went into that release. I could test turning it
back on this week if you like -- I certainly would like to have my
blks_read/cach_hits stats back. Toggling stats_block_level will
respond to a reload, yes?

Yes, as long as you had stats_start_collector on at startup.

regards, tom lane

#17Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#10)
Re: stats_block_level

Alvaro Herrera <alvherre@commandprompt.com> writes:

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

So what are we going to call the one surviving GUC variable?

regards, tom lane

#18Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#17)
Re: stats_block_level

Tom Lane wrote:

Alvaro Herrera <alvherre@commandprompt.com> writes:

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

So what are we going to call the one surviving GUC variable?

"collect_stats"

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#19Simon Riggs
simon@2ndQuadrant.com
In reply to: Alvaro Herrera (#18)
Re: stats_block_level

On Tue, 2007-07-31 at 12:33 -0400, Alvaro Herrera wrote:

Tom Lane wrote:

Alvaro Herrera <alvherre@commandprompt.com> writes:

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

So what are we going to call the one surviving GUC variable?

"collect_stats"

In the patch recently submitted, I opted for stats_collection.

Methinks it should be: stats_<something>, so that people find it in the
same place as stats_query_string, which is still there.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

#20Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Simon Riggs (#19)
Re: stats_block_level

Simon Riggs wrote:

On Tue, 2007-07-31 at 12:33 -0400, Alvaro Herrera wrote:

Tom Lane wrote:

Alvaro Herrera <alvherre@commandprompt.com> writes:

I agree. Let's remove stats_start_collector and merge the other two
into a single setting. Anything more than that is overkill.

So what are we going to call the one surviving GUC variable?

"collect_stats"

In the patch recently submitted, I opted for stats_collection.

I think we tend to give emphasis to the verb rather than the noun, e.g.
redirect_stderr, log_connections.

FWIW I just noticed we have a variable named "krb_caseins_users" which I
think is not such a great name for it. Prolly best to change it now
while it's still in the oven.

Methinks it should be: stats_<something>, so that people find it in the
same place as stats_query_string, which is still there.

Hum, but the order in postgresql.conf is arbitrary, right?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#21Simon Riggs
simon@2ndQuadrant.com
In reply to: Alvaro Herrera (#20)
#22Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#20)
#23Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#20)
#24Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#23)
#25Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#22)
#26Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#25)
#27Peter Eisentraut
peter_e@gmx.net
In reply to: Alvaro Herrera (#25)
#28Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#26)
#29Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#22)
#30Erik Jones
erik@myemma.com
In reply to: Tom Lane (#16)