Skip to content

Commit

Permalink
oracle dbsize
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico authored and jamadden committed Jun 15, 2016
1 parent 63a9eba commit f9b43a6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions relstorage/adapters/stats.py
Expand Up @@ -88,6 +88,20 @@ def get_object_count(self):

def get_db_size(self):
"""Returns the approximate size of the database in bytes"""
# May not be possible without access to the dba_* objects
return 0
conn, cursor = self.connmanager.open(
self.connmanager.isolation_read_only)
try:
stmt = """
SELECT SUM(BYTES)
FROM USER_SEGMENTS
"""
cursor.execute(stmt)
res = cursor.fetchone()[0]
if res is None:
res = 0
else:
res = int(res)
return res
finally:
self.connmanager.close(conn, cursor)

0 comments on commit f9b43a6

Please sign in to comment.