mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-24 00:20:37 +00:00
Implement pg_database_size().
In this implementation dbsize equals sum of all relation sizes, excluding shared ones.
This commit is contained in:
committed by
Anastasia Lubennikova
parent
b68e3b03ed
commit
e2cf77441d
@@ -32,7 +32,16 @@ def test_createdb(zenith_simple_env: ZenithEnv):
|
||||
|
||||
# Test that you can connect to the new database on both branches
|
||||
for db in (pg, pg2):
|
||||
db.connect(dbname='foodb').close()
|
||||
with closing(db.connect(dbname='foodb')) as conn:
|
||||
with conn.cursor() as cur:
|
||||
# Check database size in both branches
|
||||
cur.execute(
|
||||
'select pg_size_pretty(pg_database_size(%s)), pg_size_pretty(sum(pg_relation_size(oid))) from pg_class where relisshared is false;',
|
||||
('foodb', ))
|
||||
res = cur.fetchone()
|
||||
# check that dbsize equals sum of all relation sizes, excluding shared ones
|
||||
# This is how we define dbsize in zenith for now
|
||||
assert res[0] == res[1]
|
||||
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user