mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
136bea1540
pg_freespacemap_relations and pg_freespacemap_pages. Mark Kirkwood
36 lines
1.1 KiB
MySQL
36 lines
1.1 KiB
MySQL
-- Adjust this setting to control where the objects get created.
|
|
BEGIN;
|
|
SET search_path = public;
|
|
|
|
|
|
-- Register the functions.
|
|
CREATE OR REPLACE FUNCTION pg_freespacemap_pages()
|
|
RETURNS SETOF RECORD
|
|
AS 'MODULE_PATHNAME', 'pg_freespacemap_pages'
|
|
LANGUAGE C;
|
|
|
|
CREATE OR REPLACE FUNCTION pg_freespacemap_relations()
|
|
RETURNS SETOF RECORD
|
|
AS 'MODULE_PATHNAME', 'pg_freespacemap_relations'
|
|
LANGUAGE C;
|
|
|
|
|
|
-- Create views for convenient access.
|
|
CREATE VIEW pg_freespacemap_pages AS
|
|
SELECT P.* FROM pg_freespacemap_pages() AS P
|
|
(reltablespace oid, reldatabase oid, relfilenode oid, relblocknumber int8, bytes int4);
|
|
|
|
CREATE VIEW pg_freespacemap_relations AS
|
|
SELECT P.* FROM pg_freespacemap_relations() AS P
|
|
(reltablespace oid, reldatabase oid, relfilenode oid, avgrequest int8, lastpagecount integer, nextpage integer);
|
|
|
|
|
|
-- Don't want these to be available at public.
|
|
REVOKE ALL ON FUNCTION pg_freespacemap_pages() FROM PUBLIC;
|
|
REVOKE ALL ON pg_freespacemap_pages FROM PUBLIC;
|
|
|
|
REVOKE ALL ON FUNCTION pg_freespacemap_relations() FROM PUBLIC;
|
|
REVOKE ALL ON pg_freespacemap_relations FROM PUBLIC;
|
|
|
|
COMMIT;
|