effective_cache_size vs units

Started by Magnus Haganderover 19 years ago55 messageshackers
Jump to latest
#1Magnus Hagander
magnus@hagander.net

Is there any special reason why I can't use "Mb" and "Gb" and such for
effective_cache_size, the way I can for say shared_buffers?

//Magnus

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Magnus Hagander (#1)
Re: effective_cache_size vs units

Magnus Hagander wrote:

Is there any special reason why I can't use "Mb" and "Gb" and such
for effective_cache_size, the way I can for say shared_buffers?

You can't use "Mb" or "Gb" for shared_buffers either, because those are
not accepted units.

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

#3Joshua D. Drake
jd@commandprompt.com
In reply to: Peter Eisentraut (#2)
Re: effective_cache_size vs units

On Mon, 2006-12-18 at 22:08 +0100, Peter Eisentraut wrote:

Magnus Hagander wrote:

Is there any special reason why I can't use "Mb" and "Gb" and such
for effective_cache_size, the way I can for say shared_buffers?

You can't use "Mb" or "Gb" for shared_buffers either, because those are
not accepted units.

Magnus,

Here is a link that may help:
http://www.postgresql.org/docs/8.2/static/config-setting.html

It looks like it is very pedantic about the input it can receive.

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#4Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#2)
Re: effective_cache_size vs units

Peter Eisentraut wrote:

Magnus Hagander wrote:

Is there any special reason why I can't use "Mb" and "Gb" and such
for effective_cache_size, the way I can for say shared_buffers?

You can't use "Mb" or "Gb" for shared_buffers either, because those are
not accepted units.

Oh, you mean MB vs Mb. Man, it had to be that simple :)

Sorry about the noise.

//Magnus

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#4)
Re: effective_cache_size vs units

Magnus Hagander <magnus@hagander.net> writes:

Oh, you mean MB vs Mb. Man, it had to be that simple :)

ISTM we had discussed whether guc.c should accept units strings in
a case-insensitive manner, and the forces of pedantry won the first
round. Shall we reopen that argument?

regards, tom lane

#6Joshua D. Drake
jd@commandprompt.com
In reply to: Tom Lane (#5)
Re: effective_cache_size vs units

On Mon, 2006-12-18 at 23:46 -0500, Tom Lane wrote:

Magnus Hagander <magnus@hagander.net> writes:

Oh, you mean MB vs Mb. Man, it had to be that simple :)

ISTM we had discussed whether guc.c should accept units strings in
a case-insensitive manner, and the forces of pedantry won the first
round. Shall we reopen that argument?

I don't think that anyone is going to think, oh I am using 1000 Mega Bit
of ram. Mb == MB in this case. That being said, it is documented and I
don't know that it makes that much difference as long as the
documentation is clear.

Hmm perhaps perhaps a quick statement to the effect of what is legal in
the postgresql.conf? E.g;

#
# When setting memory parameters you may used a shortened sytanx e.g.,
# 1024MB or 1GB is 1 Gigabyte of ram. Note that MB/GB is capitalized.
#

Sincerely,

Joshua D. Drake

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#7Magnus Hagander
magnus@hagander.net
In reply to: Joshua D. Drake (#6)
Re: effective_cache_size vs units

On Mon, Dec 18, 2006 at 08:56:22PM -0800, Joshua D. Drake wrote:

On Mon, 2006-12-18 at 23:46 -0500, Tom Lane wrote:

Magnus Hagander <magnus@hagander.net> writes:

Oh, you mean MB vs Mb. Man, it had to be that simple :)

ISTM we had discussed whether guc.c should accept units strings in
a case-insensitive manner, and the forces of pedantry won the first
round. Shall we reopen that argument?

I don't think that anyone is going to think, oh I am using 1000 Mega Bit
of ram. Mb == MB in this case. That being said, it is documented and I
don't know that it makes that much difference as long as the
documentation is clear.

Is it possible to add an error hint to the message? Along the line of
"HINT: Did you perhaps get your casing wrong" (with better wording, of
course).

//Magnus

#8Peter Eisentraut
peter_e@gmx.net
In reply to: Magnus Hagander (#7)
Re: effective_cache_size vs units

Magnus Hagander wrote:

Is it possible to add an error hint to the message? Along the line of
"HINT: Did you perhaps get your casing wrong" (with better wording,
of course).

Or how about we just make everything case-insensitive -- but
case-preserving! -- on Windows only?

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

#9Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#8)
Re: effective_cache_size vs units

On Tue, Dec 19, 2006 at 10:01:05AM +0100, Peter Eisentraut wrote:

Magnus Hagander wrote:

Is it possible to add an error hint to the message? Along the line of
"HINT: Did you perhaps get your casing wrong" (with better wording,
of course).

Or how about we just make everything case-insensitive -- but
case-preserving! -- on Windows only?

Wouldn't help me one bit, I had this problem on the install for
search.postgresql.org, which runs on Ubuntu Linux.

//Magnus

#10Joshua D. Drake
jd@commandprompt.com
In reply to: Peter Eisentraut (#8)
Re: effective_cache_size vs units

On Tue, 2006-12-19 at 10:01 +0100, Peter Eisentraut wrote:

Magnus Hagander wrote:

Is it possible to add an error hint to the message? Along the line of
"HINT: Did you perhaps get your casing wrong" (with better wording,
of course).

Or how about we just make everything case-insensitive -- but
case-preserving! -- on Windows only?

Or we could simply add a helpful line to the postgresql.conf.

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#11Joshua D. Drake
jd@commandprompt.com
In reply to: Joshua D. Drake (#10)
Re: effective_cache_size vs units

On Tue, 2006-12-19 at 13:32 -0800, Joshua D. Drake wrote:

On Tue, 2006-12-19 at 10:01 +0100, Peter Eisentraut wrote:

Magnus Hagander wrote:

Is it possible to add an error hint to the message? Along the line of
"HINT: Did you perhaps get your casing wrong" (with better wording,
of course).

Or how about we just make everything case-insensitive -- but
case-preserving! -- on Windows only?

Or we could simply add a helpful line to the postgresql.conf.

Index: postgresql.conf.sample
===================================================================
RCS
file: /projects/cvsroot/pgsql/src/backend/utils/misc/postgresql.conf.sample,v
retrieving revision 1.199
diff -c -r1.199 postgresql.conf.sample
*** postgresql.conf.sample      21 Nov 2006 01:23:37 -0000      1.199
--- postgresql.conf.sample      19 Dec 2006 21:36:28 -0000
***************
*** 24,29 ****
--- 24,33 ----
  # settings, which are marked below, require a server shutdown and
restart
  # to take effect.
+ #
+ # Any memory setting may use a shortened notation such as 1024MB or
1GB.
+ # Please take note of the case next to the unit size.
+ #

#---------------------------------------------------------------------------
# FILE LOCATIONS

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#12Bruce Momjian
bruce@momjian.us
In reply to: Joshua D. Drake (#10)
Re: effective_cache_size vs units

Joshua D. Drake wrote:

On Tue, 2006-12-19 at 10:01 +0100, Peter Eisentraut wrote:

Magnus Hagander wrote:

Is it possible to add an error hint to the message? Along the line of
"HINT: Did you perhaps get your casing wrong" (with better wording,
of course).

Or how about we just make everything case-insensitive -- but
case-preserving! -- on Windows only?

Or we could simply add a helpful line to the postgresql.conf.

Looking at the documentation I see:

(possibly different) unit can also be specified explicitly. Valid
memory units are <literal>kB</literal> (kilobytes),
<literal>MB</literal> (megabytes), and <literal>GB</literal>
(gigabytes); valid time units are <literal>ms</literal>
(milliseconds), <literal>s</literal> (seconds),
<literal>min</literal> (minutes), <literal>h</literal> (hours),
and <literal>d</literal> (days). Note that the multiplier for
memory units is 1024, not 1000.

The only value to being case-sensitive in this area is to allow
upper/lower case with different meanings, but I don't see us using that,
so why do we bother caring about the case?

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

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

#13Joshua D. Drake
jd@commandprompt.com
In reply to: Bruce Momjian (#12)
Re: effective_cache_size vs units

On Tue, 2006-12-19 at 16:47 -0500, Bruce Momjian wrote:

Joshua D. Drake wrote:

On Tue, 2006-12-19 at 10:01 +0100, Peter Eisentraut wrote:

Magnus Hagander wrote:

Is it possible to add an error hint to the message? Along the line of
"HINT: Did you perhaps get your casing wrong" (with better wording,
of course).

Or how about we just make everything case-insensitive -- but
case-preserving! -- on Windows only?

Or we could simply add a helpful line to the postgresql.conf.

Looking at the documentation I see:

(possibly different) unit can also be specified explicitly. Valid
memory units are <literal>kB</literal> (kilobytes),
<literal>MB</literal> (megabytes), and <literal>GB</literal>
(gigabytes); valid time units are <literal>ms</literal>
(milliseconds), <literal>s</literal> (seconds),
<literal>min</literal> (minutes), <literal>h</literal> (hours),
and <literal>d</literal> (days). Note that the multiplier for
memory units is 1024, not 1000.

The only value to being case-sensitive in this area is to allow
upper/lower case with different meanings, but I don't see us using that,
so why do we bother caring about the case?

Because it is technically correct :).

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#14Peter Eisentraut
peter_e@gmx.net
In reply to: Joshua D. Drake (#11)
Re: effective_cache_size vs units

Joshua D. Drake wrote:

+ #
+ # Any memory setting may use a shortened notation such as 1024MB or
1GB.
+ # Please take note of the case next to the unit size.
+ #

Well, if you add that, you should also list all the other valid units.
But it's quite redundant, because nearly all the parameters that take
units are already listed with units in the default file. (Which makes
Magnus's mistake all the more curios.)

In my mind, this is pretty silly. There is no reputable precedent
anywhere for variant capitalization in unit names. Next thing we point
out that zeros are significant in the interior of numbers, or what?

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

#15Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#14)
Re: effective_cache_size vs units

Peter Eisentraut wrote:

Joshua D. Drake wrote:

+ #
+ # Any memory setting may use a shortened notation such as 1024MB or
1GB.
+ # Please take note of the case next to the unit size.
+ #

Well, if you add that, you should also list all the other valid units.
But it's quite redundant, because nearly all the parameters that take
units are already listed with units in the default file. (Which makes
Magnus's mistake all the more curios.)

The explanation is pretty simple. I was in a hurry to set it, just
opened the file up in vi, jumped to effective cache size, and set it. I
remembered that "hey, I can spec it in Mb now, I don't have to think,
brilliant", and just typed it in. Restarted pg and noticed it wouldn't
start...

Had I actually read through all the documentation before I did it, it
certainly wouldn't have been a problem. I doubt many users actually do
that, though. In most cases, I just assume they would just assume they
can't use units on it because the default value in the file doesn't have
units.

And frankly, this is the only case I can recall having seen when the
input is actually case sensitive between Mb and MB. Could be that I'm
not exposed to enough systems that take such input, but I can't imagine
there aren't others who would make the same mistake.

//Magnus

#16Joshua D. Drake
jd@commandprompt.com
In reply to: Peter Eisentraut (#14)
Re: effective_cache_size vs units

On Tue, 2006-12-19 at 22:59 +0100, Peter Eisentraut wrote:

Joshua D. Drake wrote:

+ #
+ # Any memory setting may use a shortened notation such as 1024MB or
1GB.
+ # Please take note of the case next to the unit size.
+ #

Well, if you add that, you should also list all the other valid units.

Why? It is clearly just an example.

But it's quite redundant, because nearly all the parameters that take
units are already listed with units in the default file. (Which makes
Magnus's mistake all the more curios.)

Not really, most people I know don't even consider the difference
between MB and Mb... shoot most people think that 1000MB equals one
Gigabyte.

In my mind, this is pretty silly. There is no reputable precedent
anywhere for variant capitalization in unit names.

I am not suggestion variant capitalization. I am suggestion a simple
document patch to help eliminate what may not be obvious.

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#17Peter Eisentraut
peter_e@gmx.net
In reply to: Bruce Momjian (#12)
Re: effective_cache_size vs units

Bruce Momjian wrote:

The only value to being case-sensitive in this area is to allow
upper/lower case with different meanings, but I don't see us using
that, so why do we bother caring about the case?

Because the units are what they are.

In broader terms, we may one day want to have other units or a
units-aware data type, so introducing incompatibilities now would be
unfortunate.

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

#18Joshua D. Drake
jd@commandprompt.com
In reply to: Joshua D. Drake (#16)
Re: effective_cache_size vs units

In my mind, this is pretty silly. There is no reputable precedent
anywhere for variant capitalization in unit names.

I am not suggestion variant capitalization. I am suggestion a simple
document patch to help eliminate what may not be obvious.

Good lord... *suggesting*

Joshua D. Drake

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#19Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#5)
Re: effective_cache_size vs units

"Tom Lane" <tgl@sss.pgh.pa.us> writes:

Magnus Hagander <magnus@hagander.net> writes:

Oh, you mean MB vs Mb. Man, it had to be that simple :)

ISTM we had discussed whether guc.c should accept units strings in
a case-insensitive manner, and the forces of pedantry won the first
round. Shall we reopen that argument?

Nope, I just checked back in the archive and that's not what happened. There
was an extended discussion about whether to force users to use the silly KiB,
MiB, etc units. Thankfully the pedants lost that round soundly.

There was no particular discussion about case sensitivity though Simon made
the case for user-friendly behaviour:

I think we are safe assume to that

kB = KB = kb = Kb = 1024 bytes

mB = MB = mb = Mb = 1024 * 1024 bytes

gB = GB = gb = Gb = 1024 * 1024 * 1024 bytes

There's no value in forcing the use of specific case and it will be just
confusing for people.

http://archives.postgresql.org/pgsql-hackers/2006-07/msg01253.php

And Jim Nasby said something similar:

Forcing people to use a specific casing scheme is just going to lead to
confusion and user frustration. If there's not a very solid *functional*
argument for it, we shouldn't do it. Wanting to enforce a convention that
people rarely use isn't a good reason.

http://archives.postgresql.org/pgsql-hackers/2006-07/msg01355.php

There was a lone comment from Thomas Hallgren in favour of case sensitivity in
the name of consistency. But Nasby's comment was directly in response and
nobody else piped up after that.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

#20Kenneth Marshall
ktm@it.is.rice.edu
In reply to: Bruce Momjian (#19)
Re: effective_cache_size vs units

On Tue, Dec 19, 2006 at 10:12:34PM +0000, Gregory Stark wrote:

"Tom Lane" <tgl@sss.pgh.pa.us> writes:

Magnus Hagander <magnus@hagander.net> writes:

Oh, you mean MB vs Mb. Man, it had to be that simple :)

ISTM we had discussed whether guc.c should accept units strings in
a case-insensitive manner, and the forces of pedantry won the first
round. Shall we reopen that argument?

Nope, I just checked back in the archive and that's not what happened. There
was an extended discussion about whether to force users to use the silly KiB,
MiB, etc units. Thankfully the pedants lost that round soundly.

There was no particular discussion about case sensitivity though Simon made
the case for user-friendly behaviour:

I think we are safe assume to that

kB = KB = kb = Kb = 1024 bytes

mB = MB = mb = Mb = 1024 * 1024 bytes

gB = GB = gb = Gb = 1024 * 1024 * 1024 bytes

There's no value in forcing the use of specific case and it will be just
confusing for people.

http://archives.postgresql.org/pgsql-hackers/2006-07/msg01253.php

And Jim Nasby said something similar:

Forcing people to use a specific casing scheme is just going to lead to
confusion and user frustration. If there's not a very solid *functional*
argument for it, we shouldn't do it. Wanting to enforce a convention that
people rarely use isn't a good reason.

http://archives.postgresql.org/pgsql-hackers/2006-07/msg01355.php

There was a lone comment from Thomas Hallgren in favour of case sensitivity in
the name of consistency. But Nasby's comment was directly in response and
nobody else piped up after that.

My one comment is that a little 'b' is used to indicate bits normally
and a capital 'B' is used to indicate bytes. So
kb = '1024 bits'
kB = '1024 bytes'
...

I do think that whether or not the k/m/g is upper case or lower case
is immaterial.

Ken

Show quoted text

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

#21Peter Eisentraut
peter_e@gmx.net
In reply to: Magnus Hagander (#15)
#22Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#21)
#23Joshua D. Drake
jd@commandprompt.com
In reply to: Magnus Hagander (#22)
#24Peter Eisentraut
peter_e@gmx.net
In reply to: Joshua D. Drake (#16)
#25Bruce Momjian
bruce@momjian.us
In reply to: Kenneth Marshall (#20)
#26Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#25)
#27Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#24)
#28Joshua D. Drake
jd@commandprompt.com
In reply to: Tom Lane (#27)
#29Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#27)
#30Peter Eisentraut
peter_e@gmx.net
In reply to: Joshua D. Drake (#28)
#31Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#27)
#32Joshua D. Drake
jd@commandprompt.com
In reply to: Peter Eisentraut (#30)
#33Joshua D. Drake
jd@commandprompt.com
In reply to: Joshua D. Drake (#28)
#34Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#29)
#35Shane Ambler
pgsql@007Marketing.com
In reply to: Peter Eisentraut (#29)
#36Jonah H. Harris
jonah.harris@gmail.com
In reply to: Tom Lane (#27)
#37Steve Atkins
steve@blighty.com
In reply to: Jonah H. Harris (#36)
#38Tom Dunstan
pgsql@tomd.cc
In reply to: Tom Lane (#34)
#39Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Dunstan (#38)
#40Andrew Dunstan
andrew@dunslane.net
In reply to: Peter Eisentraut (#39)
#41Joshua D. Drake
jd@commandprompt.com
In reply to: Steve Atkins (#37)
#42Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joshua D. Drake (#41)
#43Benny Amorsen
benny+usenet@amorsen.dk
In reply to: Magnus Hagander (#1)
#44tomas@tuxteam.de
tomas@tuxteam.de
In reply to: Benny Amorsen (#43)
#45Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Benny Amorsen (#43)
#46Benny Amorsen
benny+usenet@amorsen.dk
In reply to: Magnus Hagander (#1)
#47Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Benny Amorsen (#46)
#48Andrew Hammond
andrew.george.hammond@gmail.com
In reply to: Benny Amorsen (#43)
#49Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Hammond (#48)
#50Benny Amorsen
benny+usenet@amorsen.dk
In reply to: Magnus Hagander (#1)
#51Tom Lane
tgl@sss.pgh.pa.us
In reply to: Benny Amorsen (#50)
#52Peter Eisentraut
peter_e@gmx.net
In reply to: Jim Nasby (#45)
#53Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#52)
#54Zeugswetter Andreas SB SD
ZeugswetterA@spardat.at
In reply to: Peter Eisentraut (#52)
#55Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Andrew Hammond (#48)