Skip to content

Commit 91f1fe9

Browse files
committed
pg_buffercache: Change page_num type to bigint
The page_num was defined as integer, which should be sufficient for the near future (with 4K pages it's 8TB). But it's virtually free to return bigint, and get a wider range. This was agreed on the thread, but I forgot to tweak this in ba2a3c2. While at it, make the data types in CREATE VIEW a bit more consistent. Discussion: https://postgr.es/m/CAKZiRmxh6KWo0aqRqvmcoaX2jUxZYb4kGp3N%3Dq1w%2BDiH-696Xw%40mail.gmail.co
1 parent b8a6078 commit 91f1fe9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

contrib/pg_buffercache/pg_buffercache--1.5--1.6.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LANGUAGE C PARALLEL SAFE;
1212
-- Create a view for convenient access.
1313
CREATE VIEW pg_buffercache_numa AS
1414
SELECT P.* FROM pg_buffercache_numa_pages() AS P
15-
(bufferid integer, os_page_num int4, numa_node int4);
15+
(bufferid integer, os_page_num bigint, numa_node integer);
1616

1717
-- Don't want these to be available to public.
1818
REVOKE ALL ON FUNCTION pg_buffercache_numa_pages() FROM PUBLIC;

contrib/pg_buffercache/pg_buffercache_pages.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ typedef struct
7272
typedef struct
7373
{
7474
uint32 bufferid;
75-
int32 page_num;
75+
int64 page_num;
7676
int32 numa_node;
7777
} BufferCacheNumaRec;
7878

@@ -414,7 +414,7 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
414414
TupleDescInitEntry(tupledesc, (AttrNumber) 1, "bufferid",
415415
INT4OID, -1, 0);
416416
TupleDescInitEntry(tupledesc, (AttrNumber) 2, "os_page_num",
417-
INT4OID, -1, 0);
417+
INT8OID, -1, 0);
418418
TupleDescInitEntry(tupledesc, (AttrNumber) 3, "numa_node",
419419
INT4OID, -1, 0);
420420

@@ -522,7 +522,7 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
522522
values[0] = Int32GetDatum(fctx->record[i].bufferid);
523523
nulls[0] = false;
524524

525-
values[1] = Int32GetDatum(fctx->record[i].page_num);
525+
values[1] = Int64GetDatum(fctx->record[i].page_num);
526526
nulls[1] = false;
527527

528528
values[2] = Int32GetDatum(fctx->record[i].numa_node);

doc/src/sgml/pgbuffercache.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267

268268
<row>
269269
<entry role="catalog_table_entry"><para role="column_definition">
270-
<structfield>os_page_num</structfield> <type>int</type>
270+
<structfield>os_page_num</structfield> <type>bigint</type>
271271
</para>
272272
<para>
273273
number of OS memory page for this buffer

0 commit comments

Comments
 (0)