gooderp18绿色标准版
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

96 linhas
3.7KB

  1. /* contrib/pgstattuple/pgstattuple--1.4.sql */
  2. -- complain if script is sourced in psql, rather than via CREATE EXTENSION
  3. \echo Use "CREATE EXTENSION pgstattuple" to load this file. \quit
  4. CREATE FUNCTION pgstattuple(IN relname text,
  5. OUT table_len BIGINT, -- physical table length in bytes
  6. OUT tuple_count BIGINT, -- number of live tuples
  7. OUT tuple_len BIGINT, -- total tuples length in bytes
  8. OUT tuple_percent FLOAT8, -- live tuples in %
  9. OUT dead_tuple_count BIGINT, -- number of dead tuples
  10. OUT dead_tuple_len BIGINT, -- total dead tuples length in bytes
  11. OUT dead_tuple_percent FLOAT8, -- dead tuples in %
  12. OUT free_space BIGINT, -- free space in bytes
  13. OUT free_percent FLOAT8) -- free space in %
  14. AS 'MODULE_PATHNAME', 'pgstattuple'
  15. LANGUAGE C STRICT PARALLEL SAFE;
  16. CREATE FUNCTION pgstatindex(IN relname text,
  17. OUT version INT,
  18. OUT tree_level INT,
  19. OUT index_size BIGINT,
  20. OUT root_block_no BIGINT,
  21. OUT internal_pages BIGINT,
  22. OUT leaf_pages BIGINT,
  23. OUT empty_pages BIGINT,
  24. OUT deleted_pages BIGINT,
  25. OUT avg_leaf_density FLOAT8,
  26. OUT leaf_fragmentation FLOAT8)
  27. AS 'MODULE_PATHNAME', 'pgstatindex'
  28. LANGUAGE C STRICT PARALLEL SAFE;
  29. CREATE FUNCTION pg_relpages(IN relname text)
  30. RETURNS BIGINT
  31. AS 'MODULE_PATHNAME', 'pg_relpages'
  32. LANGUAGE C STRICT PARALLEL SAFE;
  33. /* New stuff in 1.1 begins here */
  34. CREATE FUNCTION pgstatginindex(IN relname regclass,
  35. OUT version INT4,
  36. OUT pending_pages INT4,
  37. OUT pending_tuples BIGINT)
  38. AS 'MODULE_PATHNAME', 'pgstatginindex'
  39. LANGUAGE C STRICT PARALLEL SAFE;
  40. /* New stuff in 1.2 begins here */
  41. CREATE FUNCTION pgstattuple(IN reloid regclass,
  42. OUT table_len BIGINT, -- physical table length in bytes
  43. OUT tuple_count BIGINT, -- number of live tuples
  44. OUT tuple_len BIGINT, -- total tuples length in bytes
  45. OUT tuple_percent FLOAT8, -- live tuples in %
  46. OUT dead_tuple_count BIGINT, -- number of dead tuples
  47. OUT dead_tuple_len BIGINT, -- total dead tuples length in bytes
  48. OUT dead_tuple_percent FLOAT8, -- dead tuples in %
  49. OUT free_space BIGINT, -- free space in bytes
  50. OUT free_percent FLOAT8) -- free space in %
  51. AS 'MODULE_PATHNAME', 'pgstattuplebyid'
  52. LANGUAGE C STRICT PARALLEL SAFE;
  53. CREATE FUNCTION pgstatindex(IN relname regclass,
  54. OUT version INT,
  55. OUT tree_level INT,
  56. OUT index_size BIGINT,
  57. OUT root_block_no BIGINT,
  58. OUT internal_pages BIGINT,
  59. OUT leaf_pages BIGINT,
  60. OUT empty_pages BIGINT,
  61. OUT deleted_pages BIGINT,
  62. OUT avg_leaf_density FLOAT8,
  63. OUT leaf_fragmentation FLOAT8)
  64. AS 'MODULE_PATHNAME', 'pgstatindexbyid'
  65. LANGUAGE C STRICT PARALLEL SAFE;
  66. CREATE FUNCTION pg_relpages(IN relname regclass)
  67. RETURNS BIGINT
  68. AS 'MODULE_PATHNAME', 'pg_relpagesbyid'
  69. LANGUAGE C STRICT PARALLEL SAFE;
  70. /* New stuff in 1.3 begins here */
  71. CREATE FUNCTION pgstattuple_approx(IN reloid regclass,
  72. OUT table_len BIGINT, -- physical table length in bytes
  73. OUT scanned_percent FLOAT8, -- what percentage of the table's pages was scanned
  74. OUT approx_tuple_count BIGINT, -- estimated number of live tuples
  75. OUT approx_tuple_len BIGINT, -- estimated total length in bytes of live tuples
  76. OUT approx_tuple_percent FLOAT8, -- live tuples in % (based on estimate)
  77. OUT dead_tuple_count BIGINT, -- exact number of dead tuples
  78. OUT dead_tuple_len BIGINT, -- exact total length in bytes of dead tuples
  79. OUT dead_tuple_percent FLOAT8, -- dead tuples in % (based on estimate)
  80. OUT approx_free_space BIGINT, -- estimated free space in bytes
  81. OUT approx_free_percent FLOAT8) -- free space in % (based on estimate)
  82. AS 'MODULE_PATHNAME', 'pgstattuple_approx'
  83. LANGUAGE C STRICT PARALLEL SAFE;
上海开阖软件有限公司 沪ICP备12045867号-1