dashdb


how to query disk used / available on dashDB


I would like to programmatically query the disk space used and remaining space. How can I do this in dashDB?
In oracle, I could perform something like this:
column dummy noprint
column pct_used format 999.9 heading "%|Used"
column name format a16 heading "Tablespace Name"
column bytes format 9,999,999,999,999 heading "Total Bytes"
column used format 99,999,999,999 heading "Used"
column free format 999,999,999,999 heading "Free"
break on report
compute sum of bytes on report
compute sum of free on report
compute sum of used on report
set linesize 132
set termout off
select a.tablespace_name name,
b.tablespace_name dummy,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) bytes,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) -
sum(a.bytes)/count( distinct b.file_id ) used,
sum(a.bytes)/count( distinct b.file_id ) free,
100 * ( (sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) -
(sum(a.bytes)/count( distinct b.file_id ) )) /
(sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) pct_used
from sys.dba_free_space a, sys.dba_data_files b
where a.tablespace_name = b.tablespace_name
group by a.tablespace_name, b.tablespace_name;
How would I do similar with dashDB?
A simple and fast method is to look in the catalog, which is up to date eventually (there are statistic collections done internally at certain intervals, when the catalog tables are updated with latest stats):
select substr(a.tabname,1,30), (a.fpages*PAGESIZE/1024) as size_k, a.card from syscat.tables a, syscat.tablespaces b where a.TBSPACEID=b.TBSPACEID ;
A more accurate but costly method is this:
SELECT TABSCHEMA, TABNAME, SUM(DATA_OBJECT_P_SIZE) + SUM(INDEX_OBJECT_P_SIZE)+ SUM(LONG_OBJECT_P_SIZE) + SUM(LOB_OBJECT_P_SIZE)+ SUM(XML_OBJECT_P_SIZE) FROM SYSIBMADM.ADMINTABINFO where tabschema='' and tabname='' group by tabschema,tabname;
There's currently no API call for this. (Find available API calls here: https://developer.ibm.com/clouddataservices/docs/dashdb/rest-api/) At this time, the only way to tell how much space you're using or have left is via the dashDB UI. dashDB team is exploring additional possibilities, I know. I'll post here again, if I learn more

Related Links

How to export IXF and LOB files from dashdb
Can not run sample R/dashDB script “Server Memory Usage”
Does dashDB supports spatial objects?
sql to list tables in a dashDB schema
Inconsistencies in bulk loading into DashDB via the REST API?
dashDB query node: Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0964C The transaction log for the database is full. SQLSTATE=57011
Why is loading dashDB analytics by trickle feed a bad idea?
how to get the table DDL in dashDB console?
Difference between dashDB for Analytics and dashDB for Transactions?
pip install ibmdbpy gives syntax error exec nested function
how to query disk used / available on dashDB
dashdb out of memory on Cloudant sync
how to perform 'SELECT TOP X FROM TABLE' type queries with DB2 / dashDB

Categories

HOME
visual-studio
livecode
redmine
hid
command-prompt
initialization
ontology
video-streaming
wagtail
hystrix
xamarin-zebble
locationmanager
tiff
powermock
google-awareness
django-rq
mod-wsgi
unordered-multimap
managed-c++
fusetools
data-collection
basex
boolean-logic
audit
reporting
riotjs
creation
des
testlink
nsuserdefaults
llvm-ir
best-buy-api
uipickerview
word-cloud
morphline
permission-denied
icecast
sony-future-lab-n
renderman
case-when
gmaps.js
pbx
streamwriter
jsonix
fuzzer
mathml
nsdata
powerpoint-2013
json-spirit
ibm-was
ora-04091
srv-record
auto-generate
shell-extensions
baseadapter
wicket-1.5
igor
coding-efficiency
refit
nosql-aggregation
iirf
axacropdf
tfs-sdk
office-app
wndproc
image-formats
pageheap
opends
differentiation
kext
getimagesize
activex-exe
downloadfile
service-factory

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App