cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to measure a Dataset row count and size in AI/BI Dashboards?

Mertokcu
New Contributor

Dear Databricks Community and experts, I'm creating AI/BI Dashboards using Genie LLM's /importBI function and I want the optimize my dataset by reducing my rows to 100K and size to 100MB. However, since I couldn't find a clear explanation in any resource on how to determine the number of rows in my dashboards and its size in MB, I decided ask here and hope you can help me regarding to this question. Thank you in advance. 

4 REPLIES 4

data_pulse
Contributor

@Mertokcu 

Thereโ€™s currently no row-count or size metric in the AI/BI Dashboard editor, but you can get both numbers for any dataset by running its SQL through the SQL Statement Execution API and reading the response manifest.

1. Statement Execution API

databricks api post /api/2.0/sql/statements \
  --json '{
    "warehouse_id": "YOUR_WAREHOUSE_ID",
    "statement": "SELECT ....",
    "disposition": "EXTERNAL_LINKS",
    "format": "JSON_ARRAY",
    "wait_timeout": "50s"
  }'

In the response, look at manifest:

  • total_row_count: rows returned
  • total_byte_count: result size in bytes
  • truncated: true if the result was cut off by row_limit or byte_limit, which you can optionally set in the request. If you donโ€™t set them, it should stay false.

I validated this through few experiments covering different row counts, wider datasets, JSON/Arrow formats, API limits, and SQL aggregation. The API consistently returned the relevant metrics.

2. System tables and Query History API

I also checked system.query.history, the Query History REST API and SQL Query Profile.

These expose useful statistics such as produced_rows, read_bytes, execution duration and query source. Few Caveats:

  • read_bytes is data scanned during execution, not the size of the result set.
  • Dashboard visualization queries can aggregate the dataset, so produced_rows may describe a visualizationโ€™s result, not the original dataset.

3: Dashboard API: no measured sizes

Have tested the dashboard endpoint, they return dashboard IDs, names, warehouse details, dataset SQL, visualization and filter definitions, and layout configuration. None of the responses includes measured row counts or byte counts.

It's a good idea if AI/BI dashboard  expose dataset level statistics either in data tab/ Programmatic access via Dashboard API,  especially for dashboards generated automatically using /importBI to assess dataset volume. Hopefully Databricks will consider adding this feature in future releases.

Valeria_Koz_DBX
Databricks Employee
Databricks Employee

@data_pulse Nice answer, the API trick is handy.

@Mertokcu  - A couple of things that might help too.

Worth knowing that 100K rows / 100 MB isn't a hard limit. It's where the dashboard decides where filtering happens.

  • If your dataset is under both treshholds, filters and aggregations run in the browser once it loads, which is fast and doesn't hit the warehouse again.
  • Go over either one-> each click becomes a new query on the warehouse. So bigger datasets still work, they just feel slower and cost a bit more.

The quickest way I've found to check which side you're on is Query History. Open it, click a few filters on the dashboard, and see if new queries show up wrapped in a WITH clause. If they do, you're over. If nothing new appears, you're under and running in the browser.

For just the row count, SELECT COUNT(*) FROM (<your dataset query>) in the SQL editor does it.

And if you're trying to get under the limit after /importBI, check the SQL it generated. Migrated datasets are often a SELECT * over a wide table. Picking only the columns your charts use and doing the GROUP BY in the dataset query usually cuts the size a lot, since columns add up just as much as rows.

balajij8
Esteemed Contributor III

@Mertokcu AI/BI Dashboards don't enforce a hard limit on dataset size - 100K rows and 100MB figures represent a performance threshold rather and not a cap. When the dataset stays at or under that threshold, the results are pulled directly into the browser where filtering and aggregation run client side with browser caching. Once a dataset exceeds 100K rows or 100MB, the behavior changes - the dataset SQL gets wrapped in a WITH clause and processed on the SQL warehouse backend, with individual visualization queries becoming visible in the query history. More details here


To isolate these metrics and measure datasets, you can run these checks on a SQL warehouse. For the row count, wrap dataset's SQL in SELECT COUNT(*) FROM (SQL) and run it on the warehouse. To find the size in MB which refers to the query's result set rather than the underlying table's disk size - run the dataset query as-is and inspect the statement in Query History. The execution details report both the rows produced and bytes read per query, which is surfaced in system.query.history.

datarich
Databricks Employee
Databricks Employee

 

Hi, 100K rows and 100MB aren't hard limits. They're the threshold for browser-side filtering:

  • Under both: the dataset loads into the browser, so filters and cross-filtering are instant.

  • Over either: filtering runs on the SQL warehouse, so every interaction sends a query.

Bigger datasets still work, just with more queries. Most charts also only render 15K rows, so aggregate where you can.

Row count Run SELECT COUNT(*) FROM (<your dataset query>), or check query history for your dashboard. By default only admins can query this table, and records can take up to an hour to appear.

SELECT start_time, produced_rows, statement_text
FROM system.query.history
WHERE query_source.dashboard_id = '<your-dashboard-id>'
ORDER BY start_time DESC;

Size in MB There's no direct figure. read_bytes is how much data was scanned, not the result size. To check:

  1. On the published dashboard, change a field filter to a value you haven't used recently. Use a filter, not a parameter, since parameter changes always run a query.

  2. Open Query History.

  3. If no new query appears, you're under the threshold. If you see new queries wrapped in WITH, you're over.

To get under it

  • Only select the columns you need. Wide text columns are often what pushes it past 100MB.

  • Pre-aggregate to the level your charts show.

  • Use WHERE clauses or parameters to cut down the data early.

  • Add LIMIT 100000 as a safety cap, with an ORDER BY so you keep the rows that matter, like the most recent. Keep in mind that LIMIT just drops rows, so totals and charts only reflect what's left. Use it as a backstop, not instead of filtering or aggregating. It also won't help with the 100MB side.

  • Check the datasets /importBI generates for any SELECT *.

Docs: