Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ef1c807c
Commit
ef1c807c
authored
Aug 14, 2008
by
Heikki Linnakangas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pg_buffercache needs to be taught about relation forks, as Greg Stark
pointed out.
parent
4ed300b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
11 deletions
+25
-11
contrib/pg_buffercache/pg_buffercache.sql.in
contrib/pg_buffercache/pg_buffercache.sql.in
+2
-2
contrib/pg_buffercache/pg_buffercache_pages.c
contrib/pg_buffercache/pg_buffercache_pages.c
+15
-8
doc/src/sgml/pgbuffercache.sgml
doc/src/sgml/pgbuffercache.sgml
+8
-1
No files found.
contrib/pg_buffercache/pg_buffercache.sql.in
View file @
ef1c807c
/* $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache.sql.in,v 1.
7 2007/11/13 04:24:28 momjian
Exp $ */
/* $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache.sql.in,v 1.
8 2008/08/14 12:56:41 heikki
Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
...
...
@@ -13,7 +13,7 @@ LANGUAGE C;
CREATE VIEW pg_buffercache AS
SELECT P.* FROM pg_buffercache_pages() AS P
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid,
relblocknumber int8, isdirty bool, usagecount int2);
relforknumber int2,
relblocknumber int8, isdirty bool, usagecount int2);
-- Don't want these to be available at public.
REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC;
...
...
contrib/pg_buffercache/pg_buffercache_pages.c
View file @
ef1c807c
...
...
@@ -3,7 +3,7 @@
* pg_buffercache_pages.c
* display some contents of the buffer cache
*
* $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.1
4 2007/11/15 21:14:30 momjian
Exp $
* $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.1
5 2008/08/14 12:56:41 heikki
Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
...
...
@@ -16,7 +16,7 @@
#include "utils/relcache.h"
#define NUM_BUFFERCACHE_PAGES_ELEM
7
#define NUM_BUFFERCACHE_PAGES_ELEM
8
PG_MODULE_MAGIC
;
...
...
@@ -32,6 +32,7 @@ typedef struct
Oid
relfilenode
;
Oid
reltablespace
;
Oid
reldatabase
;
ForkNumber
forknum
;
BlockNumber
blocknum
;
bool
isvalid
;
bool
isdirty
;
...
...
@@ -88,11 +89,13 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
OIDOID
,
-
1
,
0
);
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
4
,
"reldatabase"
,
OIDOID
,
-
1
,
0
);
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
5
,
"relblocknumber"
,
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
5
,
"relforknumber"
,
INT2OID
,
-
1
,
0
);
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
6
,
"relblocknumber"
,
INT8OID
,
-
1
,
0
);
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
6
,
"isdirty"
,
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
7
,
"isdirty"
,
BOOLOID
,
-
1
,
0
);
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
7
,
"usage_count"
,
TupleDescInitEntry
(
tupledesc
,
(
AttrNumber
)
8
,
"usage_count"
,
INT2OID
,
-
1
,
0
);
fctx
->
tupdesc
=
BlessTupleDesc
(
tupledesc
);
...
...
@@ -129,6 +132,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
fctx
->
record
[
i
].
relfilenode
=
bufHdr
->
tag
.
rnode
.
relNode
;
fctx
->
record
[
i
].
reltablespace
=
bufHdr
->
tag
.
rnode
.
spcNode
;
fctx
->
record
[
i
].
reldatabase
=
bufHdr
->
tag
.
rnode
.
dbNode
;
fctx
->
record
[
i
].
forknum
=
bufHdr
->
tag
.
forkNum
;
fctx
->
record
[
i
].
blocknum
=
bufHdr
->
tag
.
blockNum
;
fctx
->
record
[
i
].
usagecount
=
bufHdr
->
usage_count
;
...
...
@@ -184,6 +188,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
nulls
[
4
]
=
true
;
nulls
[
5
]
=
true
;
nulls
[
6
]
=
true
;
nulls
[
7
]
=
true
;
}
else
{
...
...
@@ -193,12 +198,14 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
nulls
[
2
]
=
false
;
values
[
3
]
=
ObjectIdGetDatum
(
fctx
->
record
[
i
].
reldatabase
);
nulls
[
3
]
=
false
;
values
[
4
]
=
Int64GetDatum
((
int64
)
fctx
->
record
[
i
].
bloc
knum
);
values
[
4
]
=
ObjectIdGetDatum
(
fctx
->
record
[
i
].
for
knum
);
nulls
[
4
]
=
false
;
values
[
5
]
=
BoolGetDatum
(
fctx
->
record
[
i
].
isdirty
);
values
[
5
]
=
Int64GetDatum
((
int64
)
fctx
->
record
[
i
].
blocknum
);
nulls
[
5
]
=
false
;
values
[
6
]
=
Int16GetDatum
(
fctx
->
record
[
i
].
usagecount
);
values
[
6
]
=
BoolGetDatum
(
fctx
->
record
[
i
].
isdirty
);
nulls
[
6
]
=
false
;
values
[
7
]
=
Int16GetDatum
(
fctx
->
record
[
i
].
usagecount
);
nulls
[
7
]
=
false
;
}
/* Build and return the tuple. */
...
...
doc/src/sgml/pgbuffercache.sgml
View file @
ef1c807c
<!-- $PostgreSQL: pgsql/doc/src/sgml/pgbuffercache.sgml,v 2.
2 2007/12/10 05:32:51 tgl
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/pgbuffercache.sgml,v 2.
3 2008/08/14 12:56:41 heikki
Exp $ -->
<sect1 id="pgbuffercache">
<title>pg_buffercache</title>
...
...
@@ -80,6 +80,13 @@
<entry>Page number within the relation</entry>
</row>
<row>
<entry><structfield>relforknumber</structfield></entry>
<entry><type>smallint</type></entry>
<entry></entry>
<entry>Fork number within the relation</entry>
</row>
<row>
<entry><structfield>isdirty</structfield></entry>
<entry><type>boolean</type></entry>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment