Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
1165bbc
Initial commit with working gp extension template
Smyatkin-Maxim Mar 18, 2024
15665d8
create function for reading list of databases ids without db from lis…
Mar 25, 2024
81ec437
add create_trunkate function; write code for main function; create pr…
Mar 25, 2024
bf81310
save commit; add functions for segments
Mar 27, 2024
bfe81d2
version with getting file_sizes problems
Mar 29, 2024
5150446
remove unused and debug functions
Mar 29, 2024
24e6bd7
try to fix bug with another creation of HeapTuple - doesn't work
Mar 29, 2024
3e77f8b
try to automaticly generate tuple desc for return result (does not help)
Mar 30, 2024
99f6c1b
first working version; fixed incorrect memory context usage for tupstore
Apr 1, 2024
f5a080c
remove unused function fields and variables
Apr 1, 2024
40fe032
add clang-format config to gitignore
Apr 3, 2024
37ae025
make sql-style naming in .sql file
Apr 3, 2024
af1e5ce
rename data collecting function
Apr 3, 2024
99a5af0
write function for creating and truncating special info tables
Apr 3, 2024
7181191
rework sql-queries and change code-style
Apr 3, 2024
7a0d23f
remove goto after elog for error
Apr 3, 2024
ef22a64
rework comments
Apr 3, 2024
0e6fa21
change elog to ereport
Apr 3, 2024
b5e2a37
rework get_collectable_db_ids function
Apr 4, 2024
5fc4da8
naming fix
Apr 4, 2024
12e346b
add more warning logging and write comments to functions
Apr 4, 2024
103fae6
move numbers in code under defines
Apr 4, 2024
72c44d4
rework fill_file_sizes function
Apr 4, 2024
81c4574
apply format
Apr 4, 2024
94b86b0
rework query creation
Apr 4, 2024
d720fc0
rework query creation
Apr 4, 2024
90c5b49
rework data_dir storing way
Apr 4, 2024
7bc162a
minor changes
Apr 5, 2024
5e0e2bd
create new schema for storing tables with plugin collected data
Apr 10, 2024
4466c15
change distribution for segment_file_map table
Apr 10, 2024
029d539
remove prepare_info_tables() and prepare_info_views() functions and u…
Apr 10, 2024
fff97e5
update segment_file_map each time that collect function called
Apr 10, 2024
6bb31ab
apply clang-format
Apr 10, 2024
472e4da
first version with background worker
Apr 11, 2024
5da85f6
initial commit for new version:
Apr 12, 2024
833579b
add some comments for naptime variables
Apr 12, 2024
47a3e2c
- fix logging issues
May 20, 2024
84ebd0e
put collectors function under PG_TRY section
May 20, 2024
35a23ad
remove unused memory context switch
Jun 13, 2024
11f4349
changes:
Jun 24, 2024
e33f0d6
- rename guc variables
Jun 24, 2024
a7639a8
- fix some incorrect comments
Jun 25, 2024
3ac08a8
free file path if warning happens
Jul 8, 2024
ef771ab
changes:
Jul 8, 2024
075844f
Merge pull request #3 from AndrewOvvv/dev-2.0
AndrewOvvv Jul 8, 2024
962f34d
rework the way of saving collected data
Jul 22, 2024
9de92ec
Merge pull request #4 from AndrewOvvv/dev-2.0
AndrewOvvv Jul 22, 2024
4e4c694
set valid naptimes
Jul 23, 2024
b9e9597
Merge pull request #5 from AndrewOvvv/dev-2.0
AndrewOvvv Jul 23, 2024
a335c73
[#1] Move stats collector logic to dynamic worker
Smyatkin-Maxim Aug 19, 2024
ae5d2ee
Merge pull request #4 from yezzey-gp/smyatkin/bg_worker_fix
AndrewOvvv Aug 19, 2024
770b246
Merge pull request #5 from yezzey-gp/master
AndrewOvvv Aug 19, 2024
7f5f386
fixed #2 issue:
Aug 19, 2024
374c6d4
fixed #3 issue:
Aug 19, 2024
e008001
bgw naming fix:
Aug 19, 2024
e707e2c
add trusted=true option into control file
Aug 19, 2024
b5185ac
Merge pull request #6 from yezzey-gp/dev-2.0
AndrewOvvv Aug 19, 2024
134dfd5
change schema's name for extension's tables
Aug 20, 2024
013b3b1
rework history table:
Aug 21, 2024
2666354
remove partitioning in backup table
Aug 21, 2024
37524a2
minor changes:
Aug 21, 2024
c86226f
Merge pull request #7 from yezzey-gp/dev-2.0
AndrewOvvv Aug 21, 2024
58a7a11
fix flags for enable extension GUC variable
Sep 25, 2024
0db0eb7
add unistd include
Sep 26, 2024
c52e435
revert GUC variable define option
Sep 26, 2024
e3799fe
Merge pull request #8 from yezzey-gp/dev-2.0
AndrewOvvv Sep 26, 2024
1585aef
minor changes:
Sep 27, 2024
631b5fa
Merge pull request #9 from yezzey-gp/dev-2.0
AndrewOvvv Sep 27, 2024
7f52153
Update README.md
AndrewOvvv Sep 27, 2024
7bb055a
add info about some tables in README
AndrewOvvv Nov 28, 2024
32fd906
split one column into two for better readability
AndrewOvvv Nov 28, 2024
6c6c3fc
fix issue in pr
AndrewOvvv Nov 28, 2024
a5f874c
Merge pull request #10 from open-gpdb/ch1nn1y-dev
AndrewOvvv Nov 28, 2024
f9d247f
fix issue #11
AndrewOvvv Nov 29, 2024
2866a16
Merge pull request #12 from open-gpdb/ch1nn1y-dev
AndrewOvvv Dec 2, 2024
3e7bdd8
try to add new functionality:
AndrewOvvv Jan 27, 2025
ad0ef38
add create_transaction argument:
AndrewOvvv Jan 27, 2025
d93d86e
main background worker changes:
AndrewOvvv Jan 27, 2025
e268e66
add info about new functionality into README file and fix old info
AndrewOvvv Jan 27, 2025
1d2481d
remove extension_enable flag
AndrewOvvv Jan 27, 2025
15d8f02
add regression tests
AndrewOvvv Jan 27, 2025
6d95020
remove gp_relsizes_stats.enabled from README
AndrewOvvv Jan 27, 2025
25cc8e6
fix issues in PR
AndrewOvvv Jan 27, 2025
c3d6c53
rename flag
AndrewOvvv Jan 27, 2025
a204fef
apply format
AndrewOvvv Jan 27, 2025
29469f6
Merge pull request #14 from open-gpdb/ch1nn1y-dev
AndrewOvvv Jan 27, 2025
f247150
change create_transaction flag type from int to bool
AndrewOvvv Jan 27, 2025
6e09261
Merge pull request #15 from open-gpdb/ch1nn1y-dev
AndrewOvvv Jan 27, 2025
18870ca
fixes in min-max values of GUC variables
AndrewOvvv Feb 3, 2025
7bf6932
Merge pull request #16 from open-gpdb/ch1nn1y-dev
AndrewOvvv Feb 3, 2025
4cd6f52
update README file:
AndrewOvvv Feb 5, 2025
7a1c35c
Merge pull request #17 from open-gpdb/ch1nn1y-dev
AndrewOvvv Feb 5, 2025
c565506
fix problem with PG_RE_THROW() cycling and rework comments in code
AndrewOvvv Aug 26, 2025
f9fd15b
add info section before every function, also fix fill relfilenode alg…
AndrewOvvv Aug 26, 2025
0b2dfe3
Merge pull request #18 from open-gpdb/ch1nn1y
AndrewOvvv Aug 28, 2025
c611e1c
Fixed typo in column name
Odyvia42 Dec 3, 2025
b9e1a1f
Speedup relsizes_collect_stats_once
andr-sokolov Dec 3, 2025
4b01159
Merge pull request #19 from Odyvia42/patch-1
AndrewOvvv Dec 3, 2025
94e1009
Remove uninformative lines from expected output
andr-sokolov Dec 3, 2025
f00648f
Merge pull request #20 from open-gpdb/speedup__relsizes_collect_stats…
AndrewOvvv Dec 3, 2025
a6a577d
Fix the calculation of a schema size when partitioned tables present
andr-sokolov Dec 5, 2025
32705fa
Merge pull request #21 from open-gpdb/fix_schema_size
AndrewOvvv Dec 5, 2025
a394fed
Use worker argument instead of shared memory to pass database to the …
andr-sokolov Dec 6, 2025
c6436bf
Merge pull request #22 from open-gpdb/remove_shared_mem
AndrewOvvv Dec 9, 2025
857b8e8
Refactoring (#23)
andr-sokolov Dec 11, 2025
454c11a
Disable Orca in workers
andr-sokolov Dec 11, 2025
0047d14
Merge pull request #24 from open-gpdb/disable_orca
NJrslv Dec 11, 2025
5886eeb
Add backward compatibility with 1.0 (#25)
andr-sokolov Dec 11, 2025
22caba7
fix typo (#26)
visill Feb 11, 2026
f906b49
do delete from table instead truncate
visill Mar 5, 2026
93785ee
Non-super users can use the extension right after they create it
andr-sokolov Apr 16, 2026
fa47d5b
Merge pull request #30 from open-gpdb/grant
AndrewOvvv Apr 16, 2026
51889a4
Add 'gpcontrib/gp_relsizes_stats/' from commit 'fa47d5b3f665c6613efa8…
May 19, 2026
910ecbb
Feat: Moved gp_relsizes_stats extention from gp
May 19, 2026
c6072c4
Fix: adapt Makefile, fix uninitialized var
May 19, 2026
6ee3710
Fix: Refactoring, correction of typos, set Licence
May 21, 2026
5020f0b
Feat: Added a license to the head of the source file
May 22, 2026
388332a
Feat: Added gp_relsizes_stats tests to workflows
May 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/build-cloudberry-rocky8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ jobs:
"make_configs":["gpcontrib/gp_stats_collector:installcheck"],
"extension":"gp_stats_collector"
},
{"test":"gpcontrib-gp-relsizes-stats",
"make_configs":["gpcontrib/gp_relsizes_stats:installcheck"],
"extension":"gp_relsizes_stats"
},
{"test":"ic-fixme",
"make_configs":["src/test/regress:installcheck-fixme"],
"enable_core_check":false
Expand Down Expand Up @@ -1445,6 +1449,17 @@ jobs:
exit 1
fi
;;
gp_relsizes_stats)
if ! su - gpadmin -c "source ${BUILD_DESTINATION}/cloudberry-env.sh && \
source ${SRC_DIR}/gpAux/gpdemo/gpdemo-env.sh && \
echo 'CREATE EXTENSION IF NOT EXISTS gp_relsizes_stats; \
TABLE pg_extension;' | \
psql postgres"
then
echo "Error creating gp_relsizes_stats extension"
exit 1
fi
;;
*)
echo "Unknown extension: ${{ matrix.extension }}"
exit 1
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/build-cloudberry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ jobs:
"make_configs":["gpcontrib/gp_stats_collector:installcheck"],
"extension":"gp_stats_collector"
},
{"test":"gpcontrib-gp-relsizes-stats",
"make_configs":["gpcontrib/gp_relsizes_stats:installcheck"],
"extension":"gp_relsizes_stats"
},
{"test":"ic-expandshrink",
"make_configs":["src/test/isolation2:installcheck-expandshrink"]
},
Expand Down Expand Up @@ -1457,6 +1461,17 @@ jobs:
exit 1
fi
;;
gp_relsizes_stats)
if ! su - gpadmin -c "source ${BUILD_DESTINATION}/cloudberry-env.sh && \
source ${SRC_DIR}/gpAux/gpdemo/gpdemo-env.sh && \
echo 'CREATE EXTENSION IF NOT EXISTS gp_relsizes_stats; \
TABLE pg_extension;' | \
psql postgres"
then
echo "Error creating gp_relsizes_stats extension"
exit 1
fi
;;
*)
echo "Unknown extension: ${{ matrix.extension }}"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions gpcontrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ifeq "$(enable_debug_extensions)" "yes"
gp_inject_fault \
gp_exttable_fdw \
gp_legacy_string_agg \
gp_relsizes_stats \
gp_replica_check \
gp_toolkit \
pg_hint_plan
Expand All @@ -28,6 +29,7 @@ else
gp_distribution_policy \
gp_internal_tools \
gp_legacy_string_agg \
gp_relsizes_stats \
gp_exttable_fdw \
gp_toolkit \
pg_hint_plan
Expand Down
192 changes: 192 additions & 0 deletions gpcontrib/gp_relsizes_stats/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Leave
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: BinPack
BasedOnStyle: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Right
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

6 changes: 6 additions & 0 deletions gpcontrib/gp_relsizes_stats/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.o
*.so
src/protos/
results
.vscode
compile_commands.json
20 changes: 20 additions & 0 deletions gpcontrib/gp_relsizes_stats/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MODULE_big = gp_relsizes_stats
OBJS = ./src/gp_relsizes_stats.o
EXTENSION = gp_relsizes_stats
EXTVERSION = 1.3
DATA = $(wildcard sql/*--*.sql)
REGRESS = grants gp_relsizes_stats
REGRESS_OPTS = --inputdir=test/
PGFILEDESC = "gp_relsizes_stats - an extension to track table on-disc sizes in Cloudberry"
PG_CXXFLAGS += $(COMMON_CPP_FLAGS)
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = gpcontrib/gp_relsizes_stats
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

70 changes: 70 additions & 0 deletions gpcontrib/gp_relsizes_stats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# gp_relsizes_stats: Table sizes monitoring tool for Cloudberry

### Features
gp_relsizes_stats is an extension for the Cloudberry database that calculates and stores statistics on the size of files and tables, occupied space on the disks of the master and segment hosts.

#### Features include
- BackgroundWorker support for collecting statistics automatically
- the ability to fine-tune the timeout values between actions, for example, between launches for different databases, or during file processing to distribute the load over time

### Supported versions and platforms
At the moment, the program is being tested only for Cloudberry and Linux.

### Installation
This extension is part of the Cloudberry monorepo under `gpcontrib/gp_relsizes_stats`.

Build and install from the Cloudberry monorepo root:
```bash
make -C gpcontrib/gp_relsizes_stats
sudo make -C gpcontrib/gp_relsizes_stats install
```

### Configuration
gp_relsizes_stats configuration parameters:
| **Parameter** | **Type** | **Default** | **Description** |
| ---------------- | --------------- | ------------ | ------------ |
| `gp_relsizes_stats.enabled` | bool | false | Using `gp_relsizes_stats.enabled` you can enable/disable background stats collection for database where extension installed (actually enable/disable background worker which collecting stats).|
| `gp_relsizes_stats.restart_naptime` | int | 21600000 | Using `gp_relsizes_stats.restart_naptime` you can set naptime between each startup of collecting process. Value set time in milliseconds. Default is equal to 6 hours.|
| `gp_relsizes_stats.database_naptime` | int | 0 | Using `gp_relsizes_stats.database_naptime` you can set naptime between collecting stats for each databases. Value set time in milliseconds. Default is equal to 0 milliseconds.|
| `gp_relsizes_stats.file_naptime` | int | 1 | Using `gp_relsizes_stats.file_naptime` you can set naptime between each file stats calculating. Value set time in milliseconds. Default is equal to 1 millisecond.|

### Usage
You can use a background worker to collect statistics, but if you sometimes need to change the format of the settings or if you don't want to collect statistics on a regular basis, you can do so. In these situations, you could set
```
gp_relsizes_stats.enabled = off
```

And use the function
```
relsizes_stats_schema.relsizes_collect_stats_once()
```
which can be called manually using 'select'.
It will launch a single statistics collection procedure.


### About collected data and tables
| Name of table | Row description | Description |
| ------------- | --------------- | ----------- |
| relsizes_stats_schema.segment_file_sizes | (segment, relfilenode, filepath, size, mtime) | Current size and last modify time of each file of specific relation on specific segment |
| relsizes_stats_schema.namespace_sizes | (nspname, nspsize) | Current size of namespace |
| relsizes_stats_schema.table_sizes | (nspname, relname, relsize) | Current size of relation in specific namespace |
| relsizes_stats_schema.table_sizes_history | (insert_date, nspname, relname, size, mtime) | Size and last modify time of relation in specific namespace with date when information was collected |
5 changes: 5 additions & 0 deletions gpcontrib/gp_relsizes_stats/gp_relsizes_stats.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# gp_relsizes_stats extension
comment = 'gp_relsizes_stats - an extension to track table on-disc sizes in cloudberry'
default_version = '1.3'
module_pathname = '$libdir/gp_relsizes_stats'
trusted = true
12 changes: 12 additions & 0 deletions gpcontrib/gp_relsizes_stats/sql/gp_relsizes_stats--1.0--1.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* gp_relsizes_stats--1.0--1.1.sql */

-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION gp_relsizes_stats" to load this file. \quit


DROP FUNCTION relsizes_stats_schema.get_stats_for_database(dboid INTEGER);

CREATE FUNCTION relsizes_stats_schema.get_stats_for_database(dboid OID, fast BOOL)
RETURNS TABLE (segment INTEGER, relfilenode OID, filepath TEXT, size BIGINT, mtime BIGINT)
AS 'MODULE_PATHNAME', 'get_stats_for_database'
LANGUAGE C STRICT EXECUTE ON ALL SEGMENTS;
Loading
Loading