Hello Chris,

> [...]
> The reason I'm asking here is that I thought it might be possible to
> query the S3QL database for this information, and that this could be
> considerably faster than trawling through all the source files'
> metadata via the FUSE interface.
If you have Sqlite Versin 3.8.3 or higher you can use the following SQL
statement (Replace 47 with the inode of the archive folder)

$ cp s3ql-database-file.db ~/tmp.db
$ # if you use Ubuntu 14.04 or another OS where you do not have sqlite3
>= 3.8.3, copy ~/tmp.db to another OS where you have a newer sqlite.
E.g. on Mac OS via "brew install sqlite3"
$ sqlite3 ~/tmp.db
.headers ON
-- use this to get the inode of the archive folder
SELECT * FROM contents_v WHERE parent_inode = 1;

-- use this (replace parent_inode = 47 with the inode of the archive
folder) to get the size of the folder on the Swift Store
WITH RECURSIVE tree
AS
(
    SELECT
        inode, parent_inode
    FROM contents
    WHERE parent_inode = 47
    UNION
    SELECT
        c.inode, c.parent_inode
    FROM
        tree
        JOIN contents c ON c.parent_inode = tree.inode
)
SELECT
    sum(o.size)/1024/1024 as "Data Size in MB"
FROM objects o
WHERE o.id IN (
    SELECT DISTINCT
        b.obj_id
    FROM tree
        JOIN inode_blocks ib ON tree.inode = ib.inode
        JOIN blocks b ON ib.block_id = b.id
);


-- 
You received this message because you are subscribed to the Google Groups 
"s3ql" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to