Skip to main content
19-Tanzanite
August 12, 2025
Solved

How to find which stream consumed more space in Database

  • August 12, 2025
  • 1 reply
  • 1117 views

Hi all,

 

We have a ThingWorx instance that has been running for the last 4 years. In the database, streams have consumed 1 TB of data. Is there a way to find out exactly which stream has consumed the most space in the database?

 

Velkumar_0-1754984515924.png

 

 

Thanks,

VR

 

Best answer by Rocko

How about naive approaches? They might take a while to run though...

 

select entity_id,count(*) from stream group by entity_id;

select entity_id,sum(pg_column_size(field_values)) from stream group by entity_id;

 

1 reply

Rocko
Rocko19-TanzaniteAnswer
19-Tanzanite
August 12, 2025

How about naive approaches? They might take a while to run though...

 

select entity_id,count(*) from stream group by entity_id;

select entity_id,sum(pg_column_size(field_values)) from stream group by entity_id;

 

Rocko
19-Tanzanite
August 12, 2025

The caveat being it may not directly reflect disk space due to how the DB organizes its tables, blocks, dead tuples and so on, but it should give an indication on the worst offenders.