As a start for a bunch of instrumentation functions that should be
included in the backend as discussed previously, here are the dbsize
functions. The dbsize.c file should go to the usual place,
src/backend/utils/adt.
Regards,
Andreas
? GNUmakefile
? config.log
? config.status
? dbsize-backend.patch
? runcfg
? contrib/admin
? contrib/postgis-1.0.0-rc3
? doc/src/sgml-8.0
? doc/src/sgml/admin.html
? doc/src/sgml/app-clusterdb.html
? doc/src/sgml/app-createdb.html
? doc/src/sgml/app-createlang.html
? doc/src/sgml/app-createuser.html
? doc/src/sgml/app-dropdb.html
? doc/src/sgml/app-droplang.html
? doc/src/sgml/app-dropuser.html
? doc/src/sgml/app-ecpg.html
? doc/src/sgml/app-initdb.html
? doc/src/sgml/app-ipcclean.html
? doc/src/sgml/app-pg-ctl.html
? doc/src/sgml/app-pg-dumpall.html
? doc/src/sgml/app-pgconfig.html
? doc/src/sgml/app-pgcontroldata.html
? doc/src/sgml/app-pgdump.html
? doc/src/sgml/app-pgresetxlog.html
? doc/src/sgml/app-pgrestore.html
? doc/src/sgml/app-postgres.html
? doc/src/sgml/app-postmaster.html
? doc/src/sgml/app-psql.html
? doc/src/sgml/app-vacuumdb.html
? doc/src/sgml/applevel-consistency.html
? doc/src/sgml/arrays.html
? doc/src/sgml/auth-methods.html
? doc/src/sgml/backup-file.html
? doc/src/sgml/backup-online.html
? doc/src/sgml/backup.html
? doc/src/sgml/bki-commands.html
? doc/src/sgml/bki-example.html
? doc/src/sgml/bki-structure.html
? doc/src/sgml/bki.html
? doc/src/sgml/bookindex.sgml
? doc/src/sgml/bug-reporting.html
? doc/src/sgml/catalog-pg-aggregate.html
? doc/src/sgml/catalog-pg-am.html
? doc/src/sgml/catalog-pg-amop.html
? doc/src/sgml/catalog-pg-amproc.html
? doc/src/sgml/catalog-pg-attrdef.html
? doc/src/sgml/catalog-pg-attribute.html
? doc/src/sgml/catalog-pg-cast.html
? doc/src/sgml/catalog-pg-class.html
? doc/src/sgml/catalog-pg-constraint.html
? doc/src/sgml/catalog-pg-conversion.html
? doc/src/sgml/catalog-pg-database.html
? doc/src/sgml/catalog-pg-depend.html
? doc/src/sgml/catalog-pg-description.html
? doc/src/sgml/catalog-pg-group.html
? doc/src/sgml/catalog-pg-index.html
? doc/src/sgml/catalog-pg-inherits.html
? doc/src/sgml/catalog-pg-language.html
? doc/src/sgml/catalog-pg-largeobject.html
? doc/src/sgml/catalog-pg-listener.html
? doc/src/sgml/catalog-pg-namespace.html
? doc/src/sgml/catalog-pg-opclass.html
? doc/src/sgml/catalog-pg-operator.html
? doc/src/sgml/catalog-pg-proc.html
? doc/src/sgml/catalog-pg-rewrite.html
? doc/src/sgml/catalog-pg-shadow.html
? doc/src/sgml/catalog-pg-statistic.html
? doc/src/sgml/catalog-pg-tablespace.html
? doc/src/sgml/catalog-pg-trigger.html
? doc/src/sgml/catalog-pg-type.html
? doc/src/sgml/catalogs.html
? doc/src/sgml/charset.html
? doc/src/sgml/client-authentication-problems.html
? doc/src/sgml/client-authentication.html
? doc/src/sgml/client-interfaces.html
? doc/src/sgml/connect-estab.html
? doc/src/sgml/creating-cluster.html
? doc/src/sgml/datatype-binary.html
? doc/src/sgml/datatype-bit.html
? doc/src/sgml/datatype-boolean.html
? doc/src/sgml/datatype-character.html
? doc/src/sgml/datatype-datetime.html
? doc/src/sgml/datatype-geometric.html
? doc/src/sgml/datatype-money.html
? doc/src/sgml/datatype-net-types.html
? doc/src/sgml/datatype-oid.html
? doc/src/sgml/datatype-pseudo.html
? doc/src/sgml/datatype.html
? doc/src/sgml/datetime-appendix.html
? doc/src/sgml/datetime-keywords.html
? doc/src/sgml/datetime-units-history.html
? doc/src/sgml/ddl-alter.html
? doc/src/sgml/ddl-constraints.html
? doc/src/sgml/ddl-default.html
? doc/src/sgml/ddl-depend.html
? doc/src/sgml/ddl-inherit.html
? doc/src/sgml/ddl-others.html
? doc/src/sgml/ddl-priv.html
? doc/src/sgml/ddl-schemas.html
? doc/src/sgml/ddl-system-columns.html
? doc/src/sgml/ddl.html
? doc/src/sgml/disk-full.html
? doc/src/sgml/diskusage.html
? doc/src/sgml/dml-delete.html
? doc/src/sgml/dml-update.html
? doc/src/sgml/dml.html
? doc/src/sgml/ecpg-commands.html
? doc/src/sgml/ecpg-connect.html
? doc/src/sgml/ecpg-descriptors.html
? doc/src/sgml/ecpg-develop.html
? doc/src/sgml/ecpg-disconnect.html
? doc/src/sgml/ecpg-dynamic.html
? doc/src/sgml/ecpg-errors.html
? doc/src/sgml/ecpg-include.html
? doc/src/sgml/ecpg-library.html
? doc/src/sgml/ecpg-process.html
? doc/src/sgml/ecpg-set-connection.html
? doc/src/sgml/ecpg-variables.html
? doc/src/sgml/ecpg.html
? doc/src/sgml/encryption-options.html
? doc/src/sgml/errcodes-appendix.html
? doc/src/sgml/error-message-reporting.html
? doc/src/sgml/error-style-guide.html
? doc/src/sgml/examples.html
? doc/src/sgml/executor.html
? doc/src/sgml/explicit-joins.html
? doc/src/sgml/explicit-locking.html
? doc/src/sgml/extend-type-system.html
? doc/src/sgml/extend.html
? doc/src/sgml/extensibility.html
? doc/src/sgml/features-supported.sgml
? doc/src/sgml/features-unsupported.sgml
? doc/src/sgml/features.html
? doc/src/sgml/functions-admin.html
? doc/src/sgml/functions-aggregate.html
? doc/src/sgml/functions-array.html
? doc/src/sgml/functions-binarystring.html
? doc/src/sgml/functions-bitstring.html
? doc/src/sgml/functions-comparison.html
? doc/src/sgml/functions-comparisons.html
? doc/src/sgml/functions-conditional.html
? doc/src/sgml/functions-datetime.html
? doc/src/sgml/functions-formatting.html
? doc/src/sgml/functions-geometry.html
? doc/src/sgml/functions-info.html
? doc/src/sgml/functions-matching.html
? doc/src/sgml/functions-math.html
? doc/src/sgml/functions-net.html
? doc/src/sgml/functions-sequence.html
? doc/src/sgml/functions-srf.html
? doc/src/sgml/functions-string.html
? doc/src/sgml/functions-subquery.html
? doc/src/sgml/functions.html
? doc/src/sgml/geqo-biblio.html
? doc/src/sgml/geqo-intro2.html
? doc/src/sgml/geqo-pg-intro.html
? doc/src/sgml/geqo.html
? doc/src/sgml/gist.html
? doc/src/sgml/groups.html
? doc/src/sgml/history.html
? doc/src/sgml/implementation.html
? doc/src/sgml/index-cost-estimation.html
? doc/src/sgml/index-functions.html
? doc/src/sgml/index-locking.html
? doc/src/sgml/index-scanning.html
? doc/src/sgml/index-unique-checks.html
? doc/src/sgml/indexam.html
? doc/src/sgml/indexes-examine.html
? doc/src/sgml/indexes-expressional.html
? doc/src/sgml/indexes-multicolumn.html
? doc/src/sgml/indexes-opclass.html
? doc/src/sgml/indexes-partial.html
? doc/src/sgml/indexes-types.html
? doc/src/sgml/indexes-unique.html
? doc/src/sgml/indexes.html
? doc/src/sgml/information-schema.html
? doc/src/sgml/infoschema-applicable-roles.html
? doc/src/sgml/infoschema-check-constraints.html
? doc/src/sgml/infoschema-column-domain-usage.html
? doc/src/sgml/infoschema-column-privileges.html
? doc/src/sgml/infoschema-column-udt-usage.html
? doc/src/sgml/infoschema-columns.html
? doc/src/sgml/infoschema-constraint-column-usage.html
? doc/src/sgml/infoschema-constraint-table-usage.html
? doc/src/sgml/infoschema-data-type-privileges.html
? doc/src/sgml/infoschema-datatypes.html
? doc/src/sgml/infoschema-domain-constraints.html
? doc/src/sgml/infoschema-domain-udt-usage.html
? doc/src/sgml/infoschema-domains.html
? doc/src/sgml/infoschema-element-types.html
? doc/src/sgml/infoschema-enabled-roles.html
? doc/src/sgml/infoschema-information-schema-catalog-name.html
? doc/src/sgml/infoschema-key-column-usage.html
? doc/src/sgml/infoschema-parameters.html
? doc/src/sgml/infoschema-referential-constraints.html
? doc/src/sgml/infoschema-role-column-grants.html
? doc/src/sgml/infoschema-role-routine-grants.html
? doc/src/sgml/infoschema-role-table-grants.html
? doc/src/sgml/infoschema-role-usage-grants.html
? doc/src/sgml/infoschema-routine-privileges.html
? doc/src/sgml/infoschema-routines.html
? doc/src/sgml/infoschema-schemata.html
? doc/src/sgml/infoschema-sql-features.html
? doc/src/sgml/infoschema-sql-implementation-info.html
? doc/src/sgml/infoschema-sql-languages.html
? doc/src/sgml/infoschema-sql-packages.html
? doc/src/sgml/infoschema-sql-sizing-profiles.html
? doc/src/sgml/infoschema-sql-sizing.html
? doc/src/sgml/infoschema-table-constraints.html
? doc/src/sgml/infoschema-table-privileges.html
? doc/src/sgml/infoschema-tables.html
? doc/src/sgml/infoschema-triggers.html
? doc/src/sgml/infoschema-usage-privileges.html
? doc/src/sgml/infoschema-view-column-usage.html
? doc/src/sgml/infoschema-view-table-usage.html
? doc/src/sgml/infoschema-views.html
? doc/src/sgml/install-getsource.html
? doc/src/sgml/install-post.html
? doc/src/sgml/install-procedure.html
? doc/src/sgml/install-requirements.html
? doc/src/sgml/install-upgrading.html
? doc/src/sgml/install-win32.html
? doc/src/sgml/installation.html
? doc/src/sgml/internals.html
? doc/src/sgml/kernel-resources.html
? doc/src/sgml/largeobjects.html
? doc/src/sgml/libpq-async.html
? doc/src/sgml/libpq-build.html
? doc/src/sgml/libpq-cancel.html
? doc/src/sgml/libpq-control.html
? doc/src/sgml/libpq-copy.html
? doc/src/sgml/libpq-envars.html
? doc/src/sgml/libpq-example.html
? doc/src/sgml/libpq-exec.html
? doc/src/sgml/libpq-fastpath.html
? doc/src/sgml/libpq-notice-processing.html
? doc/src/sgml/libpq-notify.html
? doc/src/sgml/libpq-pgpass.html
? doc/src/sgml/libpq-ssl.html
? doc/src/sgml/libpq-status.html
? doc/src/sgml/libpq-threading.html
? doc/src/sgml/libpq.html
? doc/src/sgml/limitations.html
? doc/src/sgml/ln-legalnotice.html
? doc/src/sgml/lo-examplesect.html
? doc/src/sgml/lo-funcs.html
? doc/src/sgml/lo-implementation.html
? doc/src/sgml/lo-interfaces.html
? doc/src/sgml/locking-indexes.html
? doc/src/sgml/logfile-maintenance.html
? doc/src/sgml/maintenance.html
? doc/src/sgml/manage-ag-config.html
? doc/src/sgml/manage-ag-createdb.html
? doc/src/sgml/manage-ag-dropdb.html
? doc/src/sgml/manage-ag-tablespaces.html
? doc/src/sgml/manage-ag-templatedbs.html
? doc/src/sgml/managing-databases.html
? doc/src/sgml/migration.html
? doc/src/sgml/monitoring-locks.html
? doc/src/sgml/monitoring-stats.html
? doc/src/sgml/monitoring.html
? doc/src/sgml/multibyte.html
? doc/src/sgml/mvcc.html
? doc/src/sgml/nls-programmer.html
? doc/src/sgml/nls.html
? doc/src/sgml/notation.html
? doc/src/sgml/overview.html
? doc/src/sgml/parser-stage.html
? doc/src/sgml/performance-tips.html
? doc/src/sgml/perm-functions.html
? doc/src/sgml/planner-optimizer.html
? doc/src/sgml/planner-stats-details.html
? doc/src/sgml/planner-stats.html
? doc/src/sgml/plhandler.html
? doc/src/sgml/plperl-data.html
? doc/src/sgml/plperl-database.html
? doc/src/sgml/plperl-global.html
? doc/src/sgml/plperl-missing.html
? doc/src/sgml/plperl-triggers.html
? doc/src/sgml/plperl-trusted.html
? doc/src/sgml/plperl.html
? doc/src/sgml/plpgsql-control-structures.html
? doc/src/sgml/plpgsql-cursors.html
? doc/src/sgml/plpgsql-declarations.html
? doc/src/sgml/plpgsql-development-tips.html
? doc/src/sgml/plpgsql-errors-and-messages.html
? doc/src/sgml/plpgsql-expressions.html
? doc/src/sgml/plpgsql-porting.html
? doc/src/sgml/plpgsql-statements.html
? doc/src/sgml/plpgsql-structure.html
? doc/src/sgml/plpgsql-trigger.html
? doc/src/sgml/plpgsql.html
? doc/src/sgml/plpython-database.html
? doc/src/sgml/plpython-trigger.html
? doc/src/sgml/plpython.html
? doc/src/sgml/pltcl-data.html
? doc/src/sgml/pltcl-dbaccess.html
? doc/src/sgml/pltcl-functions.html
? doc/src/sgml/pltcl-global.html
? doc/src/sgml/pltcl-procnames.html
? doc/src/sgml/pltcl-trigger.html
? doc/src/sgml/pltcl-unknown.html
? doc/src/sgml/pltcl.html
? doc/src/sgml/populate.html
? doc/src/sgml/postgres.xml
? doc/src/sgml/postmaster-shutdown.html
? doc/src/sgml/postmaster-start.html
? doc/src/sgml/preface.html
? doc/src/sgml/privileges.html
? doc/src/sgml/protocol-changes.html
? doc/src/sgml/protocol-error-fields.html
? doc/src/sgml/protocol-flow.html
? doc/src/sgml/protocol-message-formats.html
? doc/src/sgml/protocol-message-types.html
? doc/src/sgml/protocol.html
? doc/src/sgml/queries-limit.html
? doc/src/sgml/queries-order.html
? doc/src/sgml/queries-select-lists.html
? doc/src/sgml/queries-table-expressions.html
? doc/src/sgml/queries-union.html
? doc/src/sgml/queries.html
? doc/src/sgml/reference-client.html
? doc/src/sgml/reference-server.html
? doc/src/sgml/reference.html
? doc/src/sgml/regress-evaluation.html
? doc/src/sgml/regress-platform.html
? doc/src/sgml/regress.html
? doc/src/sgml/resources.html
? doc/src/sgml/routine-reindex.html
? doc/src/sgml/rowtypes.html
? doc/src/sgml/rule-system.html
? doc/src/sgml/rules-privileges.html
? doc/src/sgml/rules-status.html
? doc/src/sgml/rules-triggers.html
? doc/src/sgml/rules-update.html
? doc/src/sgml/rules-views.html
? doc/src/sgml/rules.html
? doc/src/sgml/runtime-config.html
? doc/src/sgml/runtime.html
? doc/src/sgml/server-programming.html
? doc/src/sgml/source.html
? doc/src/sgml/spi-examples.html
? doc/src/sgml/spi-interface-support.html
? doc/src/sgml/spi-memory.html
? doc/src/sgml/spi-realloc.html
? doc/src/sgml/spi-spi-connect.html
? doc/src/sgml/spi-spi-copytuple.html
? doc/src/sgml/spi-spi-cursor-close.html
? doc/src/sgml/spi-spi-cursor-fetch.html
? doc/src/sgml/spi-spi-cursor-find.html
? doc/src/sgml/spi-spi-cursor-move.html
? doc/src/sgml/spi-spi-cursor-open.html
? doc/src/sgml/spi-spi-exec.html
? doc/src/sgml/spi-spi-execp.html
? doc/src/sgml/spi-spi-execute-plan.html
? doc/src/sgml/spi-spi-execute.html
? doc/src/sgml/spi-spi-finish.html
? doc/src/sgml/spi-spi-fname.html
? doc/src/sgml/spi-spi-fnumber.html
? doc/src/sgml/spi-spi-freeplan.html
? doc/src/sgml/spi-spi-freetuple.html
? doc/src/sgml/spi-spi-freetupletable.html
? doc/src/sgml/spi-spi-getargcount.html
? doc/src/sgml/spi-spi-getargtypeid.html
? doc/src/sgml/spi-spi-getbinval.html
? doc/src/sgml/spi-spi-getnspname.html
? doc/src/sgml/spi-spi-getrelname.html
? doc/src/sgml/spi-spi-gettype.html
? doc/src/sgml/spi-spi-gettypeid.html
? doc/src/sgml/spi-spi-getvalue.html
? doc/src/sgml/spi-spi-is-cursor-plan.html
? doc/src/sgml/spi-spi-modifytuple.html
? doc/src/sgml/spi-spi-palloc.html
? doc/src/sgml/spi-spi-pfree.html
? doc/src/sgml/spi-spi-pop.html
? doc/src/sgml/spi-spi-prepare.html
? doc/src/sgml/spi-spi-push.html
? doc/src/sgml/spi-spi-returntuple.html
? doc/src/sgml/spi-spi-saveplan.html
? doc/src/sgml/spi-visibility.html
? doc/src/sgml/spi.html
? doc/src/sgml/sql-abort.html
? doc/src/sgml/sql-alteraggregate.html
? doc/src/sgml/sql-alterconversion.html
? doc/src/sgml/sql-alterdatabase.html
? doc/src/sgml/sql-alterdomain.html
? doc/src/sgml/sql-alterfunction.html
? doc/src/sgml/sql-altergroup.html
? doc/src/sgml/sql-alterindex.html
? doc/src/sgml/sql-alterlanguage.html
? doc/src/sgml/sql-alteropclass.html
? doc/src/sgml/sql-alteroperator.html
? doc/src/sgml/sql-alterschema.html
? doc/src/sgml/sql-altersequence.html
? doc/src/sgml/sql-altertable.html
? doc/src/sgml/sql-altertablespace.html
? doc/src/sgml/sql-altertrigger.html
? doc/src/sgml/sql-altertype.html
? doc/src/sgml/sql-alteruser.html
? doc/src/sgml/sql-analyze.html
? doc/src/sgml/sql-begin.html
? doc/src/sgml/sql-checkpoint.html
? doc/src/sgml/sql-close.html
? doc/src/sgml/sql-cluster.html
? doc/src/sgml/sql-commands.html
? doc/src/sgml/sql-comment.html
? doc/src/sgml/sql-commit.html
? doc/src/sgml/sql-copy.html
? doc/src/sgml/sql-createaggregate.html
? doc/src/sgml/sql-createcast.html
? doc/src/sgml/sql-createconstraint.html
? doc/src/sgml/sql-createconversion.html
? doc/src/sgml/sql-createdatabase.html
? doc/src/sgml/sql-createdomain.html
? doc/src/sgml/sql-createfunction.html
? doc/src/sgml/sql-creategroup.html
? doc/src/sgml/sql-createindex.html
? doc/src/sgml/sql-createlanguage.html
? doc/src/sgml/sql-createopclass.html
? doc/src/sgml/sql-createoperator.html
? doc/src/sgml/sql-createrule.html
? doc/src/sgml/sql-createschema.html
? doc/src/sgml/sql-createsequence.html
? doc/src/sgml/sql-createtable.html
? doc/src/sgml/sql-createtableas.html
? doc/src/sgml/sql-createtablespace.html
? doc/src/sgml/sql-createtrigger.html
? doc/src/sgml/sql-createtype.html
? doc/src/sgml/sql-createuser.html
? doc/src/sgml/sql-createview.html
? doc/src/sgml/sql-deallocate.html
? doc/src/sgml/sql-declare.html
? doc/src/sgml/sql-delete.html
? doc/src/sgml/sql-dropaggregate.html
? doc/src/sgml/sql-dropcast.html
? doc/src/sgml/sql-dropconversion.html
? doc/src/sgml/sql-dropdatabase.html
? doc/src/sgml/sql-dropdomain.html
? doc/src/sgml/sql-dropfunction.html
? doc/src/sgml/sql-dropgroup.html
? doc/src/sgml/sql-dropindex.html
? doc/src/sgml/sql-droplanguage.html
? doc/src/sgml/sql-dropopclass.html
? doc/src/sgml/sql-dropoperator.html
? doc/src/sgml/sql-droprule.html
? doc/src/sgml/sql-dropschema.html
? doc/src/sgml/sql-dropsequence.html
? doc/src/sgml/sql-droptable.html
? doc/src/sgml/sql-droptablespace.html
? doc/src/sgml/sql-droptrigger.html
? doc/src/sgml/sql-droptype.html
? doc/src/sgml/sql-dropuser.html
? doc/src/sgml/sql-dropview.html
? doc/src/sgml/sql-end.html
? doc/src/sgml/sql-execute.html
? doc/src/sgml/sql-explain.html
? doc/src/sgml/sql-expressions.html
? doc/src/sgml/sql-fetch.html
? doc/src/sgml/sql-grant.html
? doc/src/sgml/sql-insert.html
? doc/src/sgml/sql-keywords-appendix.html
? doc/src/sgml/sql-listen.html
? doc/src/sgml/sql-load.html
? doc/src/sgml/sql-lock.html
? doc/src/sgml/sql-move.html
? doc/src/sgml/sql-notify.html
? doc/src/sgml/sql-prepare.html
? doc/src/sgml/sql-reindex.html
? doc/src/sgml/sql-release-savepoint.html
? doc/src/sgml/sql-reset.html
? doc/src/sgml/sql-revoke.html
? doc/src/sgml/sql-rollback-to.html
? doc/src/sgml/sql-rollback.html
? doc/src/sgml/sql-savepoint.html
? doc/src/sgml/sql-select.html
? doc/src/sgml/sql-selectinto.html
? doc/src/sgml/sql-set-constraints.html
? doc/src/sgml/sql-set-session-authorization.html
? doc/src/sgml/sql-set-transaction.html
? doc/src/sgml/sql-set.html
? doc/src/sgml/sql-show.html
? doc/src/sgml/sql-start-transaction.html
? doc/src/sgml/sql-syntax.html
? doc/src/sgml/sql-truncate.html
? doc/src/sgml/sql-unlisten.html
? doc/src/sgml/sql-update.html
? doc/src/sgml/sql-vacuum.html
? doc/src/sgml/sql.html
? doc/src/sgml/ssh-tunnels.html
? doc/src/sgml/ssl-tcp.html
? doc/src/sgml/storage-page-layout.html
? doc/src/sgml/storage-toast.html
? doc/src/sgml/storage.html
? doc/src/sgml/supported-platforms.html
? doc/src/sgml/transaction-iso.html
? doc/src/sgml/trigger-datachanges.html
? doc/src/sgml/trigger-example.html
? doc/src/sgml/trigger-interface.html
? doc/src/sgml/triggers.html
? doc/src/sgml/tutorial-accessdb.html
? doc/src/sgml/tutorial-advanced.html
? doc/src/sgml/tutorial-agg.html
? doc/src/sgml/tutorial-arch.html
? doc/src/sgml/tutorial-concepts.html
? doc/src/sgml/tutorial-conclusion.html
? doc/src/sgml/tutorial-createdb.html
? doc/src/sgml/tutorial-delete.html
? doc/src/sgml/tutorial-fk.html
? doc/src/sgml/tutorial-inheritance.html
? doc/src/sgml/tutorial-join.html
? doc/src/sgml/tutorial-populate.html
? doc/src/sgml/tutorial-select.html
? doc/src/sgml/tutorial-sql.html
? doc/src/sgml/tutorial-start.html
? doc/src/sgml/tutorial-table.html
? doc/src/sgml/tutorial-transactions.html
? doc/src/sgml/tutorial-update.html
? doc/src/sgml/tutorial-views.html
? doc/src/sgml/tutorial.html
? doc/src/sgml/typeconv-func.html
? doc/src/sgml/typeconv-oper.html
? doc/src/sgml/typeconv-query.html
? doc/src/sgml/typeconv-union-case.html
? doc/src/sgml/typeconv.html
? doc/src/sgml/unsupported-features-sql-standard.html
? doc/src/sgml/user-attributes.html
? doc/src/sgml/user-manag.html
? doc/src/sgml/version.sgml
? doc/src/sgml/view-pg-indexes.html
? doc/src/sgml/view-pg-locks.html
? doc/src/sgml/view-pg-rules.html
? doc/src/sgml/view-pg-settings.html
? doc/src/sgml/view-pg-stats.html
? doc/src/sgml/view-pg-tables.html
? doc/src/sgml/view-pg-user.html
? doc/src/sgml/view-pg-views.html
? doc/src/sgml/views-overview.html
? doc/src/sgml/wal-configuration.html
? doc/src/sgml/wal-internals.html
? doc/src/sgml/wal.html
? doc/src/sgml/xaggr.html
? doc/src/sgml/xfunc-c.html
? doc/src/sgml/xfunc-internal.html
? doc/src/sgml/xfunc-overload.html
? doc/src/sgml/xfunc-pl.html
? doc/src/sgml/xfunc-sql.html
? doc/src/sgml/xfunc-volatility.html
? doc/src/sgml/xfunc.html
? doc/src/sgml/xindex.html
? doc/src/sgml/xoper-optimization.html
? doc/src/sgml/xoper.html
? doc/src/sgml/xplang.html
? doc/src/sgml/xtypes.html
? src/Makefile.global
? src/backend/postgres
? src/backend/catalog/postgres.bki
? src/backend/catalog/postgres.description
? src/backend/utils/adt/dbsize.c
? src/backend/utils/adt/ruleutils.diff
? src/backend/utils/mb/conversion_procs/conversion_create.sql
? src/backend/utils/mb/conversion_procs/ascii_and_mic/libascii_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/cyrillic_and_mic/libcyrillic_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/euc_cn_and_mic/libeuc_cn_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/libeuc_jp_and_sjis.so.0.0
? src/backend/utils/mb/conversion_procs/euc_kr_and_mic/libeuc_kr_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/euc_tw_and_big5/libeuc_tw_and_big5.so.0.0
? src/backend/utils/mb/conversion_procs/latin2_and_win1250/liblatin2_and_win1250.so.0.0
? src/backend/utils/mb/conversion_procs/latin_and_mic/liblatin_and_mic.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_ascii/libutf8_and_ascii.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_big5/libutf8_and_big5.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/libutf8_and_cyrillic.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/libutf8_and_euc_cn.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/libutf8_and_euc_jp.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/libutf8_and_euc_kr.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/libutf8_and_euc_tw.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_gb18030/libutf8_and_gb18030.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_gbk/libutf8_and_gbk.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_iso8859/libutf8_and_iso8859.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/libutf8_and_iso8859_1.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_johab/libutf8_and_johab.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_sjis/libutf8_and_sjis.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_tcvn/libutf8_and_tcvn.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_uhc/libutf8_and_uhc.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_win1250/libutf8_and_win1250.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_win1252/libutf8_and_win1252.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_win1256/libutf8_and_win1256.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_win1258/libutf8_and_win1258.so.0.0
? src/backend/utils/mb/conversion_procs/utf8_and_win874/libutf8_and_win874.so.0.0
? src/bin/initdb/initdb
? src/bin/ipcclean/ipcclean
? src/bin/pg_config/pg_config
? src/bin/pg_controldata/pg_controldata
? src/bin/pg_ctl/pg_ctl
? src/bin/pg_dump/pg_dump
? src/bin/pg_dump/pg_dumpall
? src/bin/pg_dump/pg_restore
? src/bin/pg_resetxlog/pg_resetxlog
? src/bin/psql/psql
? src/bin/scripts/clusterdb
? src/bin/scripts/createdb
? src/bin/scripts/createlang
? src/bin/scripts/createuser
? src/bin/scripts/dropdb
? src/bin/scripts/droplang
? src/bin/scripts/dropuser
? src/bin/scripts/vacuumdb
? src/include/pg_config.h
? src/include/stamp-h
? src/interfaces/ecpg/compatlib/libecpg_compat.so.1.1
? src/interfaces/ecpg/compatlib/libecpg_compat.so.2.1
? src/interfaces/ecpg/ecpglib/libecpg.so.4.2
? src/interfaces/ecpg/ecpglib/libecpg.so.5.1
? src/interfaces/ecpg/pgtypeslib/libpgtypes.so.1.2
? src/interfaces/ecpg/pgtypeslib/libpgtypes.so.2.1
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/libpq/libpq.so.3.2
? src/interfaces/libpq/libpq.so.4.1
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/port/pg_config_paths.h
? src/timezone/zic
Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.250
diff -u -r1.250 func.sgml
--- doc/src/sgml/func.sgml 23 May 2005 01:50:01 -0000 1.250
+++ doc/src/sgml/func.sgml 1 Jun 2005 18:50:16 -0000
@@ -8970,6 +8970,83 @@
For details about proper usage of these functions, see
<xref linkend="backup-online">.
</para>
+
+ <indexterm zone="functions-admin">
+ <primary>pg_tablespace_size</primary>
+ </indexterm>
+ <indexterm zone="functions-admin">
+ <primary>pg_database_size</primary>
+ </indexterm>
+ <indexterm zone="functions-admin">
+ <primary>pg_relation_size</primary>
+ </indexterm>
+ <indexterm zone="functions-admin">
+ <primary>pg_size_pretty</primary>
+ </indexterm>
+
+ <para>
+ The functions shown in <xref
+ linkend="functions-admin-dbsize"> calculate the actual disk space
+ usage of database objects.
+ </para>
+
+ <table id="functions-admin-dbsize">
+ <title>Database Object Size Functions</title>
+ <tgroup cols="3">
+ <thead>
+ <row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>
+ <literal><function>pg_tablespace_size</function>(<parameter>tablespace_oid</parameter>)</literal>
+ </entry>
+ <entry><type>int8</type></entry>
+ <entry>Calculates total disk space of a tablespace</entry>
+ </row>
+ <row>
+ <entry>
+ <literal><function>pg_database_size</function>(<parameter>database_oid</parameter>)</literal>
+ </entry>
+ <entry><type>int8</type></entry>
+ <entry>Calculates total disk space of a database</entry>
+ </row>
+ <row>
+ <entry>
+ <literal><function>pg_relation_size</function>(<parameter>relation_oid</parameter>)</literal>
+ </entry>
+ <entry><type>int8</type></entry>
+ <entry>Calculates total disk space of a relation</entry>
+ </row>
+ <row>
+ <entry>
+ <literal><function>pg_size_pretty</function>(<parameter>size_int8</parameter>)</literal>
+ </entry>
+ <entry><type>text</type></entry>
+ <entry>Formats the size in a human readable format with size units </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>
+ <function>pg_tablespace_size</>, <function>pg_tablespace_size</>
+ and <function>pg_relation_size</> accept an oid, and calculate
+ the disk space usage of the object.
+ </para>
+ <para>
+ <function>pg_relation_size</> accepts oids of standard tables, indexes and
+ toast tables. To calculate the disk space usage of a table
+ including all its indexes and toast tables, these components need
+ to be summed up.
+ </para>
+ <para>
+ <function>pg_size_pretty</> can be used to format the size of the
+ database objects in a human readable way, using kB, MB, GB or TB as appropriate.
+ </para>
+
</sect1>
</chapter>
Index: src/backend/utils/adt/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/Makefile,v
retrieving revision 1.57
diff -u -r1.57 Makefile
--- src/backend/utils/adt/Makefile 1 Apr 2004 21:28:45 -0000 1.57
+++ src/backend/utils/adt/Makefile 1 Jun 2005 18:50:20 -0000
@@ -24,7 +24,7 @@
tid.o timestamp.o varbit.o varchar.o varlena.o version.o xid.o \
network.o mac.o inet_net_ntop.o inet_net_pton.o \
ri_triggers.o pg_lzcompress.o pg_locale.o formatting.o \
- ascii.o quote.o pgstatfuncs.o encode.o
+ ascii.o quote.o pgstatfuncs.o encode.o dbsize.o
like.o: like.c like_match.c
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
retrieving revision 1.363
diff -u -r1.363 pg_proc.h
--- src/include/catalog/pg_proc.h 20 May 2005 01:29:55 -0000 1.363
+++ src/include/catalog/pg_proc.h 1 Jun 2005 18:50:38 -0000
@@ -3023,6 +3023,15 @@
DATA(insert OID = 2173 ( pg_stop_backup PGNSP PGUID 12 f f t f v 0 25 "" _null_ _null_ _null_
pg_stop_backup- _null_ ));
DESCR("Finish taking an online backup");
+DATA(insert OID = 2285 ( pg_tablespace_size PGNSP PGUID 12 f f t f v 1 20 "26" _null_ _null_ _null_
pg_tablespace_size- _null_ ));
+DESCR("Calculate total disk space usage for tablespace");
+DATA(insert OID = 2286 ( pg_database_size PGNSP PGUID 12 f f t f v 1 20 "26" _null_ _null_ _null_
pg_database_size- _null_ ));
+DESCR("Calculate total disk space usage for database");
+DATA(insert OID = 2287 ( pg_relation_size PGNSP PGUID 12 f f t f v 1 20 "26" _null_ _null_ _null_
pg_relation_size- _null_ ));
+DESCR("Calculate total disk space usage for relation");
+DATA(insert OID = 2288 ( pg_size_pretty PGNSP PGUID 12 f f t f v 1 25 "20" _null_ _null_ _null_
pg_size_pretty- _null_ ));
+DESCR("Convert a long int to a human readable text using size units");
+
/* Aggregates (moved here from pg_aggregate for 7.3) */
Index: src/include/utils/builtins.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/utils/builtins.h,v
retrieving revision 1.257
diff -u -r1.257 builtins.h
--- src/include/utils/builtins.h 27 May 2005 00:57:49 -0000 1.257
+++ src/include/utils/builtins.h 1 Jun 2005 18:50:41 -0000
@@ -364,6 +364,12 @@
extern Datum pg_cancel_backend(PG_FUNCTION_ARGS);
extern Datum pg_tablespace_databases(PG_FUNCTION_ARGS);
+/* dbsize.c */
+extern Datum pg_tablespace_size(PG_FUNCTION_ARGS);
+extern Datum pg_database_size(PG_FUNCTION_ARGS);
+extern Datum pg_relation_size(PG_FUNCTION_ARGS);
+extern Datum pg_size_pretty(PG_FUNCTION_ARGS);
+
/* not_in.c */
extern Datum int4notin(PG_FUNCTION_ARGS);
extern Datum oidnotin(PG_FUNCTION_ARGS);
/*
* dbsize.c
* object size functions
*
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/contrib/dbsize/dbsize.c,v 1.17 2005/05/27 00:57:48 neilc Exp $
*
*/
#include "postgres.h"
#include <sys/types.h>
#include <sys/stat.h>
#include "access/heapam.h"
#include "catalog/namespace.h"
#include "catalog/pg_tablespace.h"
#include "commands/dbcommands.h"
#include "miscadmin.h"
#include "storage/fd.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
/* Return physical size of directory contents, or 0 if dir doesn't exist */
static int64
db_dir_size(const char *path)
{
int64 dirsize = 0;
struct dirent *direntry;
DIR *dirdesc;
char filename[MAXPGPATH];
dirdesc = AllocateDir(path);
if (!dirdesc)
return 0;
while ((direntry = readdir(dirdesc)) != NULL)
{
struct stat fst;
if (strcmp(direntry->d_name, ".") == 0 ||
strcmp(direntry->d_name, "..") == 0)
continue;
snprintf(filename, MAXPGPATH, "%s/%s", path, direntry->d_name);
if (stat(filename, &fst) < 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not stat \"%s\": %m", filename)));
dirsize += fst.st_size;
}
FreeDir(dirdesc);
return dirsize;
}
static int64
calculate_database_size(Oid dbOid)
{
int64 totalsize = 0;
DIR *dirdesc;
struct dirent *direntry;
char pathname[MAXPGPATH];
/* Shared storage in pg_global is not counted */
/* Include pg_default storage */
snprintf(pathname, MAXPGPATH, "%s/base/%u", DataDir, dbOid);
totalsize += db_dir_size(pathname);
/* Scan the non-default tablespaces */
snprintf(pathname, MAXPGPATH, "%s/pg_tblspc", DataDir);
dirdesc = AllocateDir(pathname);
if (!dirdesc)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not open tablespace directory \"%s\": %m",
pathname)));
while ((direntry = readdir(dirdesc)) != NULL)
{
if (strcmp(direntry->d_name, ".") == 0 ||
strcmp(direntry->d_name, "..") == 0)
continue;
snprintf(pathname, MAXPGPATH, "%s/pg_tblspc/%s/%u",
DataDir, direntry->d_name, dbOid);
totalsize += db_dir_size(pathname);
}
FreeDir(dirdesc);
/* Complain if we found no trace of the DB at all */
if (!totalsize)
ereport(ERROR,
(ERRCODE_UNDEFINED_DATABASE,
errmsg("database with OID %u does not exist", dbOid)));
return totalsize;
}
/*
* calculate total size of tablespace
*/
Datum
pg_tablespace_size(PG_FUNCTION_ARGS)
{
Oid tblspcOid = PG_GETARG_OID(0);
char tblspcPath[MAXPGPATH];
char pathname[MAXPGPATH];
int64 totalsize=0;
DIR *dirdesc;
struct dirent *direntry;
if (tblspcOid == DEFAULTTABLESPACE_OID)
snprintf(tblspcPath, MAXPGPATH, "%s/base", DataDir);
else if (tblspcOid == GLOBALTABLESPACE_OID)
snprintf(tblspcPath, MAXPGPATH, "%s/global", DataDir);
else
snprintf(tblspcPath, MAXPGPATH, "%s/pg_tblspc/%u", DataDir, tblspcOid);
dirdesc = AllocateDir(tblspcPath);
if (!dirdesc)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not open tablespace directory \"%s\": %m",
tblspcPath)));
while ((direntry = readdir(dirdesc)) != NULL)
{
struct stat fst;
if (strcmp(direntry->d_name, ".") == 0 ||
strcmp(direntry->d_name, "..") == 0)
continue;
snprintf(pathname, MAXPGPATH, "%s/%s", tblspcPath, direntry->d_name);
if (stat(pathname, &fst) < 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not stat \"%s\": %m", pathname)));
totalsize += fst.st_size;
if (fst.st_mode & S_IFDIR)
totalsize += db_dir_size(pathname);
}
FreeDir(dirdesc);
PG_RETURN_INT64(totalsize);
}
/*
* calculate size of database in all tablespaces
*/
Datum
pg_database_size(PG_FUNCTION_ARGS)
{
Oid dbOid = PG_GETARG_OID(0);
PG_RETURN_INT64(calculate_database_size(dbOid));
}
/* Calculate relation size given tablespace and relation OIDs */
static int64
calculate_relation_size(Oid tblspcOid, Oid relnodeOid)
{
int64 totalsize=0;
unsigned int segcount=0;
char dirpath[MAXPGPATH];
char pathname[MAXPGPATH];
if (!tblspcOid)
tblspcOid = MyDatabaseTableSpace;
if (tblspcOid == DEFAULTTABLESPACE_OID)
snprintf(dirpath, MAXPGPATH, "%s/base/%u", DataDir, MyDatabaseId);
else if (tblspcOid == GLOBALTABLESPACE_OID)
snprintf(dirpath, MAXPGPATH, "%s/global", DataDir);
else
snprintf(dirpath, MAXPGPATH, "%s/pg_tblspc/%u/%u",
DataDir, tblspcOid, MyDatabaseId);
for (segcount = 0 ;; segcount++)
{
struct stat fst;
if (segcount == 0)
snprintf(pathname, MAXPGPATH, "%s/%u",
dirpath, relnodeOid);
else
snprintf(pathname, MAXPGPATH, "%s/%u.%u",
dirpath, relnodeOid, segcount);
if (stat(pathname, &fst) < 0)
{
if (errno == ENOENT)
break;
else
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not stat \"%s\": %m", pathname)));
}
totalsize += fst.st_size;
}
return totalsize;
}
/*
* calculate size of relation
*/
Datum
pg_relation_size(PG_FUNCTION_ARGS)
{
Oid relOid=PG_GETARG_OID(0);
HeapTuple tuple;
Form_pg_class pg_class;
Oid relnodeOid;
Oid tblspcOid;
tuple = SearchSysCache(RELOID,
ObjectIdGetDatum(relOid),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(ERRCODE_UNDEFINED_TABLE,
errmsg("relation with OID %u does not exist", relOid)));
pg_class = (Form_pg_class) GETSTRUCT(tuple);
relnodeOid = pg_class->relfilenode;
tblspcOid = pg_class->reltablespace;
ReleaseSysCache(tuple);
PG_RETURN_INT64(calculate_relation_size(tblspcOid, relnodeOid));
}
/*
* formatting with size units
*/
Datum
pg_size_pretty(PG_FUNCTION_ARGS)
{
int64 size=PG_GETARG_INT64(0);
char *result=palloc(50+VARHDRSZ);
int64 limit = 10*1024;
int64 mult=1;
if (size < limit*mult)
snprintf(VARDATA(result), 50, INT64_FORMAT" bytes",
size);
else
{
mult *= 1024;
if (size < limit*mult)
snprintf(VARDATA(result), 50, INT64_FORMAT " kB",
(size+mult/2) / mult);
else
{
mult *= 1024;
if (size < limit*mult)
snprintf(VARDATA(result), 50, INT64_FORMAT " MB",
(size+mult/2) / mult);
else
{
mult *= 1024;
if (size < limit*mult)
snprintf(VARDATA(result), 50, INT64_FORMAT " GB",
(size+mult/2) / mult);
else
{
mult *= 1024;
snprintf(VARDATA(result), 50, INT64_FORMAT " TB",
(size+mult/2) / mult);
}
}
}
}
VARATT_SIZEP(result) = strlen(VARDATA(result)) + VARHDRSZ;
PG_RETURN_TEXT_P(result);
}