Skip to content

Commit 7ab0ef5

Browse files
committed
Change cfs_fragmentation function
1 parent 77cbc91 commit 7ab0ef5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/src/sgml/cfs.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
As it was mentioned before, CFS always appends updated blocks to the end of the compressed file. So physical size of the file
309309
can be greater than used size in this file. I.e. CFS file is fragmented and defragmentation is periodically performed by CFS
310310
garbage collector. <varname>cfs_fragmentation(relation)</varname> functions returns average fragmentation of relation files.
311-
It is calculated as rum of physical sizes of the files divided by sum of used size of the files.
311+
It is calculated as sum of physical sizes of the files minus sum of used size of the files divided by sum of physical sizes of the files.
312312
</para>
313313

314314
<para>

src/backend/storage/file/cfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ Datum cfs_fragmentation(PG_FUNCTION_ARGS)
10641064
pfree(map_path);
10651065
relation_close(rel, AccessShareLock);
10661066
}
1067-
PG_RETURN_FLOAT8((double)physSize/usedSize);
1067+
PG_RETURN_FLOAT8((double)(physSize - usedSize)/physSize);
10681068
}
10691069

10701070
Datum cfs_gc_activity_processed_bytes(PG_FUNCTION_ARGS)

0 commit comments

Comments
 (0)