Обсуждение: Finding Current Page Size

Поиск
Список
Период
Сортировка

Finding Current Page Size

От
Curt Sampson
Дата:
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

Re: Finding Current Page Size

От
Bruce Momjian
Дата:
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

Re: Finding Current Page Size

От
Curt Sampson
Дата:
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

Re: Finding Current Page Size

От
Alvaro Herrera
Дата:
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)

Re: Finding Current Page Size

От
Curt Sampson
Дата:
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