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
functional-programming
bots
operating-system
haproxy
code-formatting
embedded-resource
cryptography
openflow
flurry
share
cdi
phpmqtt
angular2-template
cisco
anchor
selection
solution
xades4j
alljoyn
tiff
orc
grocery-crud
exec-maven-plugin
codefluent
uislider
amazon-sns
ini
pyopencl
beego
msdeploy
tf-idf
marquee
cube
amazon-iam
matlab-app-designer
counting
oauth2
optionaldataexception
morphline
xcode8.2
rightnow-crm
section508
renderman
freshdesk
mechanicalturk
google-shopping-api
system.web.optimization
livecycle
spring-mongo
traversable
maven-release-plugin
qpixmap
simian
univocity
django-validation
opencyc
http.client
unhandled
gql
modern.ie
r.java-file
google-hangouts
microsoft-expression-web
cakephp-2.2
rubber
device-admin
adwords-apiv201402
inequality
webautomation
preorder
hotswap
proxy-server
mft
compiler-flags
colon
ggts
infinite
frontbase
django-facebook
ax
acceptance-testing
chartfx
gprof
cgrectmake
playorm
instance-variables
clearinterval
uipangesturerecognizer
haiku
filelock
kext
jquery-1.4
bass
oracle-pro-c
projectpier
data-retrieval
tacit-programming
watchpoint

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App