[SCM] PostGIS branch master updated. 3.5.0-308-g935e23f3c
git at osgeo.org
git at osgeo.org
Mon May 5 07:46:07 PDT 2025
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via 935e23f3c42b24ed9074e77e5473ae18ab8eedbe (commit)
via 67f74870b08ba5e29f07084a0cf976e9ac345d1c (commit)
from b999711b28317faf283a4ce77abdd97ea424490e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 935e23f3c42b24ed9074e77e5473ae18ab8eedbe
Author: Sandro Santilli <strk at kbt.io>
Date: Mon May 5 16:14:06 2025 +0200
Add topology.TotalTopologySize function
Includes regress test and documentation
Closes #5894
diff --git a/NEWS b/NEWS
index 28471efa8..709c09d44 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ PostGIS 3.6.0
* New Features *
+ - #5894, TotalTopologySize (Sandro Santilli)
- #5890, ValidateTopologyPrecision, MakeTopologyPrecise (Sandro Santilli)
- #5861, Add --drop-topology switch to pgtopo_import (Sandro Santilli)
- #1247, ST_AsRasterAgg (Sandro Santilli)
diff --git a/doc/extras_topology.xml b/doc/extras_topology.xml
index 71f4e9cda..9d4b2d01f 100644
--- a/doc/extras_topology.xml
+++ b/doc/extras_topology.xml
@@ -1208,6 +1208,62 @@ SELECT layer_id(findLayer('features.land_parcels', 'feature'));
<para><xref linkend="FindTopology"/></para>
</refsection>
</refentry>
+
+ <refentry xml:id="TotalTopologySize">
+ <refnamediv>
+ <refname>TotalTopologySize</refname>
+
+ <refpurpose>Total disk space used by the specified topology, including all indexes and TOAST data.</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>int8 <function>TotalTopologySize</function></funcdef>
+ <paramdef><type>name </type> <parameter>toponame</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>
+Takes a topology name and provides the total
+disk space used by all its tables, including indexes and TOAST data.
+ </para>
+
+ <!-- use this format if new function -->
+ <para role="availability" conformance="3.6.0">Availability: 3.6.0</para>
+ </refsection>
+
+
+ <refsection>
+ <title>Examples</title>
+ <programlisting>SELECT topology.topologysummary('city_data');
+ topologysummary
+--------------------------------------------------------
+ Topology city_data (329), SRID 4326, precision: 0
+ 22 nodes, 24 edges, 10 faces, 29 topogeoms in 5 layers
+ Layer 1, type Polygonal (3), 9 topogeoms
+ Deploy: features.land_parcels.feature
+ Layer 2, type Puntal (1), 8 topogeoms
+ Deploy: features.traffic_signs.feature
+ Layer 3, type Lineal (2), 8 topogeoms
+ Deploy: features.city_streets.feature
+ Layer 4, type Polygonal (3), 3 topogeoms
+ Hierarchy level 1, child layer 1
+ Deploy: features.big_parcels.feature
+ Layer 5, type Puntal (1), 1 topogeoms
+ Hierarchy level 1, child layer 2
+ Deploy: features.big_signs.feature</programlisting>
+ </refsection>
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="Topology_Load_Tiger"/></para>
+ </refsection>
+ </refentry>
</section>
<section xml:id="Topology_StatsManagement" xreflabel="maintaining statistics during topology editing and population">
diff --git a/topology/Makefile.in b/topology/Makefile.in
index 0339a5dee..a728814c6 100644
--- a/topology/Makefile.in
+++ b/topology/Makefile.in
@@ -143,6 +143,7 @@ topology.sql: \
sql/manage/FindTopology.sql.in \
sql/manage/ManageHelper.sql.in \
sql/manage/MakeTopologyPrecise.sql.in \
+ sql/manage/TotalTopologySize.sql.in \
sql/manage/populate_topology_layer.sql.in \
sql/manage/RenameTopology.sql.in \
sql/manage/TopologySummary.sql.in \
diff --git a/topology/sql/manage/TotalTopologySize.sql.in b/topology/sql/manage/TotalTopologySize.sql.in
new file mode 100644
index 000000000..d68989c97
--- /dev/null
+++ b/topology/sql/manage/TotalTopologySize.sql.in
@@ -0,0 +1,39 @@
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+--
+-- PostGIS - Spatial Types for PostgreSQL
+-- http://postgis.net
+--
+-- Copyright (C) 2025 Sandro Santilli <strk at kbt.io>
+--
+-- This is free software; you can redistribute and/or modify it under
+-- the terms of the GNU General Public Licence. See the COPYING file.
+--
+-- Author: Sandro Santilli <strk at kbt.io>
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+-- Availability: 3.6.0
+CREATE OR REPLACE FUNCTION topology.TotalTopologySize(toponame name)
+RETURNS int8
+AS $BODY$
+DECLARE
+ sql TEXT;
+ total_size int8;
+BEGIN
+ sql := format(
+ $$
+SELECT
+pg_catalog.pg_total_relation_size('%1$I.edge_data') +
+pg_catalog.pg_total_relation_size('%1$I.node') +
+pg_catalog.pg_total_relation_size('%1$I.face') +
+pg_catalog.pg_total_relation_size('%1$I.relation')
+ $$,
+ toponame
+ );
+
+ EXECUTE sql INTO total_size;
+ RETURN total_size;
+
+END;
+$BODY$ LANGUAGE 'plpgsql' STABLE;
diff --git a/topology/test/regress/totaltopologysize.sql b/topology/test/regress/totaltopologysize.sql
new file mode 100644
index 000000000..cda203c5a
--- /dev/null
+++ b/topology/test/regress/totaltopologysize.sql
@@ -0,0 +1,19 @@
+\set VERBOSITY terse
+set client_min_messages to ERROR;
+
+BEGIN;
+
+SELECT NULL FROM topology.CreateTopology('t0');
+SELECT NULL FROM topology.CreateTopology('t1');
+
+SELECT 't0', topology.TotalTopologySize('t0') = topology.TotalTopologySize('t1');
+
+SELECT NULL FROM topology.TopoGeo_addPoint('t0', 'POINT(0 0)');
+
+SELECT 't1', topology.TotalTopologySize('t0') > topology.TotalTopologySize('t1');
+
+SELECT NULL FROM topology.TopoGeo_addLineString('t1', 'LINESTRING(0 0, 5 6)');
+
+SELECT 't2', topology.TotalTopologySize('t0') < topology.TotalTopologySize('t1');
+
+ROLLBACK;
diff --git a/topology/test/regress/totaltopologysize_expected b/topology/test/regress/totaltopologysize_expected
new file mode 100644
index 000000000..f1b8b1333
--- /dev/null
+++ b/topology/test/regress/totaltopologysize_expected
@@ -0,0 +1,3 @@
+t0|t
+t1|t
+t2|t
diff --git a/topology/test/tests.mk b/topology/test/tests.mk
index 3776692c1..024823110 100644
--- a/topology/test/tests.mk
+++ b/topology/test/tests.mk
@@ -87,6 +87,7 @@ TESTS += \
$(top_srcdir)/topology/test/regress/topogeometry_type.sql \
$(top_srcdir)/topology/test/regress/topojson.sql \
$(top_srcdir)/topology/test/regress/topologysummary.sql \
+ $(top_srcdir)/topology/test/regress/totaltopologysize.sql \
$(top_srcdir)/topology/test/regress/totopogeom.sql \
$(top_srcdir)/topology/test/regress/validatetopologyprecision.sql \
$(top_srcdir)/topology/test/regress/validatetopologyrelation.sql \
diff --git a/topology/topology.sql.in b/topology/topology.sql.in
index c2ba6f303..91d603ea6 100644
--- a/topology/topology.sql.in
+++ b/topology/topology.sql.in
@@ -1403,6 +1403,7 @@ LANGUAGE 'plpgsql' VOLATILE STRICT;
#include "sql/manage/ValidateTopologyRelation.sql.in"
#include "sql/manage/ValidateTopologyPrecision.sql.in"
#include "sql/manage/MakeTopologyPrecise.sql.in"
+#include "sql/manage/TotalTopologySize.sql.in"
-- Cleanup functions
#include "sql/cleanup/RemoveUnusedPrimitives.sql.in"
commit 67f74870b08ba5e29f07084a0cf976e9ac345d1c
Author: Sandro Santilli <strk at kbt.io>
Date: Mon May 5 16:13:32 2025 +0200
Encode availability of MakeTopologyPrecise/ValidateTopologyPrecision
diff --git a/topology/sql/manage/MakeTopologyPrecise.sql.in b/topology/sql/manage/MakeTopologyPrecise.sql.in
index 24cf395ac..e66eea2fb 100644
--- a/topology/sql/manage/MakeTopologyPrecise.sql.in
+++ b/topology/sql/manage/MakeTopologyPrecise.sql.in
@@ -17,6 +17,7 @@
-- Invalidities are represented by any vertex that does not fall on
-- the topology precision grid.
-- }{
+-- Availability: 3.6.0
CREATE OR REPLACE FUNCTION topology.MakeTopologyPrecise(toponame name, bbox GEOMETRY DEFAULT NULL, gridSize float8 DEFAULT NULL)
RETURNS void AS
$BODY$
diff --git a/topology/sql/manage/ValidateTopologyPrecision.sql.in b/topology/sql/manage/ValidateTopologyPrecision.sql.in
index 0119bc401..bdb5fb386 100644
--- a/topology/sql/manage/ValidateTopologyPrecision.sql.in
+++ b/topology/sql/manage/ValidateTopologyPrecision.sql.in
@@ -17,6 +17,7 @@
-- Invalidities are represented by any vertex that does not fall on
-- the topology precision grid.
-- }{
+-- Availability: 3.6.0
CREATE OR REPLACE FUNCTION topology.ValidateTopologyPrecision(toponame name, bbox geometry DEFAULT NULL, gridSize float8 DEFAULT NULL)
RETURNS geometry AS
$BODY$
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
doc/extras_topology.xml | 56 ++++++++++++++++++++++
topology/Makefile.in | 1 +
topology/sql/manage/MakeTopologyPrecise.sql.in | 1 +
topology/sql/manage/TotalTopologySize.sql.in | 39 +++++++++++++++
.../sql/manage/ValidateTopologyPrecision.sql.in | 1 +
topology/test/regress/totaltopologysize.sql | 19 ++++++++
topology/test/regress/totaltopologysize_expected | 3 ++
topology/test/tests.mk | 1 +
topology/topology.sql.in | 1 +
10 files changed, 123 insertions(+)
create mode 100644 topology/sql/manage/TotalTopologySize.sql.in
create mode 100644 topology/test/regress/totaltopologysize.sql
create mode 100644 topology/test/regress/totaltopologysize_expected
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list