Monitor Live Data Query Consumption
You can use the
Platform Consumption Console
to monitor consumption from your Live Data Query usage.Rows Scanned
The
Rows Scanned
metric counts the rows scanned to run a query, not just the rows returned by the query.You can try the following query patterns to reduce the number of rows scanned. Note that none of these patterns guarantee a reduction in rows scanned:
- COUNT with no filter:Using a count with no filter or something likeCOUNT(id)results in 1 row scanned.
- COUNT with filters:Rows scanned equals the number of rows after the filter is applied.
- LIMIT:In most cases, limits are pushed down. Limits up to 1000 scan the specified number of rows; limits above 1000 scan in pages of 1000 (Example: ALIMIT 1001query scans 2000 rows, i.e. 2 pages of 1000).LIMIT 1on a non-selective query scans ~1 row per split rather than the full table. Limit pushdowns don't apply to dynamic tables, join-pushdown tables, orORDER BY ... LIMIT (Top-N).
Examples
Assume a worker table of 100,000:
SQL | Rows scanned | Rows returned | Explanation |
|---|---|---|---|
SELECT COUNT(*) FROM worker
| 1 | 1 | Unfiltered count is answered without reading the table. |
SELECT COUNT(*) FROM worker where name like 'j%'
| 5000 | 1 | Filter is pushed down; 5000 rows match. |
SELECT * FROM worker
| 100,000 | 100,000 | Full read. |
SELECT * FROM worker LIMIT 10
| 10 | 10 | Limit is pushed down. |
SELECT * FROM worker LIMIT 1000
| 1000 | 1000 | Limit is pushed down. |
SELECT * FROM worker LIMIT 1500
| 2000 | 1500 | Rows are scanned in pages of 1000 so limiting by 1500 is 2 pages of 1000. |
SELECT * FROM worker LIMIT 2000
| 2000 | 2000 | Rows are scanned in pages of 1000 so limiting by 2000 is 2 pages of 1000. |
SELECT * FROM worker WHERE date > 2001
| 40,000 | 40,000 | Filter is pushed down; 40,000 rows match. |
SELECT * FROM worker WHERE name LIKE 'j%'
| 40,000 | 40,000 | Filter is pushed down; 40,000 rows match. |
SELECT * FROM worker ORDER BY name LIMIT 2000
| 100,000 | 2,000 | Limit pushdowns don't apply to ORDER BY ... LIMIT (Top-N) queries. |