# Top 50 Largest Uploads broken script

**URL:** <https://meta.discourse.org/t/top-50-largest-uploads-broken-script/284017>\
**Category:** Bug\
**Tags:** data-explorer\
**Created:** [October 31, 2023, 2:58pm UTC](https://meta.discourse.org/t/top-50-largest-uploads-broken-script/284017 "2023-10-31T14:58:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [October 31, 2023, 3:16pm UTC](https://meta.discourse.org/t/top-50-largest-uploads-broken-script/284017/2 "2023-10-31T15:16:33Z")

</div>

Ah yes. The `post_uploads` table has been deprecated. I think it needs to use the `uploads` and `upload_references` tables now?

Thanks for the report. 👍

> <https://github.com/discourse/discourse-data-explorer/blob/main/lib/discourse_data_explorer/queries.rb#L353>

* * *

I think this is the updated version if you need it @Ivan_Rapekas:

```sql
SELECT posts.id AS post_id,
    uploads.original_filename,
    ROUND(uploads.filesize / 1000000.0, 2) AS size_in_mb,
    uploads.extension,
    uploads.created_at,
    uploads.url
FROM upload_references
JOIN uploads ON uploads.id = upload_references.upload_id
JOIN posts ON posts.id = upload_references.target_id AND upload_references.target_type = 'Post'
ORDER BY uploads.filesize DESC
LIMIT 50

```

---

_[View the full topic](https://meta.discourse.org/t/top-50-largest-uploads-broken-script/284017)._
