
# How can I view the largest binary files within my database?

> SQL queries for SQL Server, Oracle, and MySQL that list stored files from largest to smallest.

URL: https://www.hannonhill.com/cascadecms/latest/articles/cascade-administration/database-tools/view-largest-binary-files.html
category: Cascade Administration
article-type: reference
content-kind: faq
release-availability: all
tags: database
updated: 2026-10-06

The following queries list files from your database from largest to smallest. They're useful when the database has grown unexpectedly and you need to find what's taking the space.

## SQL Server

```sql
SELECT s.name as site_name, f.cachePath, b.id, datalength(data)
FROM cxml_blob b
join cxml_foldercontent f on b.id=f.fileBlobId
join cxml_site s on s.id = f.siteid
order by datalength(data) DESC;
```

## Oracle

```sql
SELECT f.cachePath, b.id, dbms_lob.getLength(data)
FROM dbNameHere.cxml_blob b
join dbNameHere.cxml_foldercontent f on b.id=f.fileBlobId
order by dbms_lob.getLength(data) DESC nulls last;
```

Replace `dbNameHere` with your actual database name.

## MySQL

```sql
SELECT s.name as site_name, f.cachePath, b.id, OCTET_LENGTH(data)
FROM cxml_blob b
join cxml_foldercontent f on b.id=f.fileBlobId
join cxml_site s on s.id = f.siteid
order by OCTET_LENGTH(data) DESC;
```

For what to do with the results, see [Database Size Management Tips](https://www.hannonhill.com/cascadecms/latest/articles/cascade-administration/installation-and-upgrades/database/db-size-manage.html).
