marcos espinola
marcos espinola

Reputation: 3

Know the size of a query result in Databricks SQL from a Delta Table?

I want know the size of a query. Does exist any form to know that?

For example, I can know the size of a complete delta table looking the catalog, but I need to know the size from a particular subquery from a table because I need to perform a good partitioning in the table, and knowing the size can give a approach of it.

In my case, I want to perform a partition by calendar_month_id (ex '202502') and to know if it match with the suggestion of databricks's documentation, it must has at least 1 GB of size for that particular query.

But again, I don't know any form in Databricks SQL to analyse the size of a subquery.

Anybody know?

Upvotes: 0

Views: 52

Answers (1)

samhita
samhita

Reputation: 3490

By size of query I am assuming you mean size in bytes. You can use length function to get the number of bytes.

select sum(length(col1) + length(cast(col2 as string)) ) as row_size
from <table>
where condition;

Assuming col1 is string.

See a similar question for Mysql

Upvotes: 0

Related Questions