Finding Current Page Size

Started by Curt Sampsonalmost 23 years ago5 messagesgeneral
Jump to latest
#1Curt Sampson
cjs@cynic.net

How do I, in SQL, find out the page size used in the current database
cluster?

(Please cc me on the answer.)

cjs
--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC

#2Bruce Momjian
bruce@momjian.us
In reply to: Curt Sampson (#1)
Re: Finding Current Page Size

Curt Sampson wrote:

How do I, in SQL, find out the page size used in the current database
cluster?

Sure, but I am not sure how to determine this from SQL:

$ pg_controldata
pg_control version number: 72
Catalog version number: 200306051
Database cluster state: in production
pg_control last modified: 06/16/03 10:39:47
Current log file ID: 0
Next log file segment: 3
Latest checkpoint location: 0/27114C8
Prior checkpoint location: 0/941EB4
Latest checkpoint's REDO location: 0/27114C8
Latest checkpoint's UNDO location: 0/0
Latest checkpoint's StartUpID: 13
Latest checkpoint's NextXID: 6174
Latest checkpoint's NextOID: 156346
Time of latest checkpoint: 06/16/03 10:39:45
Database block size: 8192

^^^^
Blocks per segment of large relation: 131072
Maximum length of identifiers: 64
Maximum number of function arguments: 32
Date/time type storage: Floating point
Maximum length of locale name: 128
LC_COLLATE: C
LC_CTYPE: C

-- 
  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
#3Curt Sampson
cjs@cynic.net
In reply to: Bruce Momjian (#2)
Re: Finding Current Page Size

On Mon, 16 Jun 2003, Bruce Momjian wrote:

Curt Sampson wrote:

How do I, in SQL, find out the page size used in the current database
cluster?

Sure, but I am not sure how to determine this from SQL:

$ pg_controldata
...
Database block size: 8192

Right. So, basically, write a C function to do it. I'll probably get
around to doing that one day and contributing it, but it's not really
all that high on my priority list right now.

cjs
--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC

#4Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Curt Sampson (#3)
Re: Finding Current Page Size

On Tue, Jun 17, 2003 at 06:40:14PM +0900, Curt Sampson wrote:

Right. So, basically, write a C function to do it. I'll probably get
around to doing that one day and contributing it, but it's not really
all that high on my priority list right now.

#include <postgres_fe.h>
int GetPageSize() {
return BLCKSZ;
}

Is that it?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Sallah, I said NO camels! That's FIVE camels; can't you count?"
(Indiana Jones)

#5Curt Sampson
cjs@cynic.net
In reply to: Alvaro Herrera (#4)
Re: Finding Current Page Size

On Thu, 19 Jun 2003, Alvaro Herrera wrote:

#include <postgres_fe.h>
int GetPageSize() {
return BLCKSZ;
}

Is that it?

Something closer to this, I'd think:

Datum
get_change_log_staff_id(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(change_log_staff_id);
};

cjs
--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC