Skip to content

Instantly share code, notes, and snippets.

@fixlr
Created November 10, 2009 21:09
Show Gist options
  • Save fixlr/231270 to your computer and use it in GitHub Desktop.
Save fixlr/231270 to your computer and use it in GitHub Desktop.
DSpace: Determine size (in bytes) of a community (top of 3 tiers)
SELECT SUM(size_bytes)
FROM bitstream, bundle, bundle2bitstream, item2bundle
WHERE item2bundle.bundle_id = bundle2bitstream.bundle_id
AND bundle2bitstream.bitstream_id = bitstream.bitstream_id
AND item2bundle.bundle_id = bundle.bundle_id
AND bundle.name = 'ORIGINAL'
AND item2bundle.item_id = ANY(
SELECT item_id
FROM item
WHERE owning_collection = ANY(
SELECT collection_id
FROM community2collection
WHERE community_id = ANY(
SELECT child_comm_id
FROM community2community
WHERE parent_comm_id = 19)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment