提交 e5f1b9f7 编写于 作者: S Shreedhar Hardikar 提交者: GitHub

Expose UDF in a view to retrieve workfiles used diskspace (#1142)

[#130666969]
Internally this is the shared memory variable used_segspace in
the view gp_toolkit.gp_workfile_mgr_used_diskspace.
Signed-off-by: NXin Zhang <xzhang@pivotal.io>
上级 ef42590d
......@@ -2032,6 +2032,7 @@ LANGUAGE C IMMUTABLE;
GRANT EXECUTE ON FUNCTION gp_toolkit.__gp_workfile_entries_f() TO public;
--------------------------------------------------------------------------------
-- @view:
-- gp_toolkit.gp_workfile_entries
......@@ -2133,6 +2134,55 @@ GROUP BY (datname, procpid, sess_id, command_cnt, usename, current_query, segid,
GRANT SELECT ON gp_toolkit.gp_workfile_usage_per_query TO public;
--------------------------------------------------------------------------------
-- @function:
-- gp_toolkit.__gp_workfile_mgr_used_diskspace_f
--
-- @in:
--
-- @out:
-- int - segment id
-- bigint - size in bytes,
--
-- @doc:
-- UDF to retrieve workfile used diskspace counter in bytes per segment
--
--------------------------------------------------------------------------------
CREATE FUNCTION gp_toolkit.__gp_workfile_mgr_used_diskspace_f()
RETURNS SETOF record
AS '$libdir/gp_workfile_mgr', 'gp_workfile_mgr_used_diskspace'
LANGUAGE C IMMUTABLE;
GRANT EXECUTE ON FUNCTION gp_toolkit.__gp_workfile_mgr_used_diskspace_f() TO public;
--------------------------------------------------------------------------------
-- @view:
-- gp_toolkit.gp_workfile_mgr_used_diskspace
--
-- @doc:
-- Workfile used diskspace counter in bytes per segment
--
--------------------------------------------------------------------------------
CREATE VIEW gp_toolkit.gp_workfile_mgr_used_diskspace AS
WITH all_entries AS (
SELECT C.*
FROM gp_toolkit.__gp_localid, gp_toolkit.__gp_workfile_mgr_used_diskspace_f() as C (
segid int,
bytes bigint
)
UNION ALL
SELECT C.*
FROM gp_toolkit.__gp_masterid, gp_toolkit.__gp_workfile_mgr_used_diskspace_f() as C (
segid int,
bytes bigint
))
SELECT segid, bytes
FROM all_entries
ORDER BY segid;
GRANT SELECT ON gp_toolkit.gp_workfile_mgr_used_diskspace TO public;
--------------------------------------------------------------------------------
-- @function:
-- gp_toolkit.gp_dump_query_oids(text)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册