sb_get_table_size (public)

 sb_get_table_size -table_name table_name [ -namespace namespace ] \
    [ -block_size block_size ]

Defined in packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl

Returns the size of the table on disk. This information is only updated by the commands VACUUM, ANALYZE, and CREATE INDEX. Thus, if you have been changing your table, run ANALYZE on the table before running this proc.

Switches:
-table_name
(required)
The table name
-namespace
(defaults to "public") (optional)
The database namespace that contains the table
-block_size
(defaults to "8192") (optional)
Size of BLCKSZ (in bytes) used by the database
Returns:
This procedure returns a list with 2 items:
  1. Size of the table on disk (in bytes), or -1 if the table was not found
  2. Number of rows in the table, or -1 if the table was not found
Author:
Gabriel Burca <gburca-openacs@ebixio.com>
Created:
2004-06-27

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_table_description sb_get_table_description (public) sb_get_table_size sb_get_table_size sb_get_table_description->sb_get_table_size db_0or1row db_0or1row (public) sb_get_table_size->db_0or1row

Testcases:
No testcase defined.
Source code:
    set res [db_0or1row sb_get_table_size {
        select relpages * :block_size as size_in_bytes, reltuples as table_rows
        from pg_class
        where relnamespace = (select oid from pg_namespace where nspname = :namespace)
        and relname = :table_name
    }]
    if {$res} {
        return [list $size_in_bytes $table_rows]
    } else {
        # No such table in the namespace?
        return [list -1 -1]
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: