Get query stats
This page describes how to getquery stats using thecbt CLI. You canalso get query stats using the Go client library for Cloud Bigtable.
The content provided here is intended for application developers. Before youread this page, you should understand theBigtable storage model. Youshould also be familiar withSchema design best practices andunderstand performance.
The ability to get information about a Bigtable query can beuseful when you are developing an application. It lets you get data on a query'sperformance and then adjust the query or change your schema design to fine-tunethe performance of your query.
Although in general aquery is any data request sent to a table,Bigtable returns query statistics only for read requests.
Before you begin
- If you haven't already installed the
cbtCLI, follow theinstructions on thecbtCLIoverview including the steps to create a.cbtrcfile. - Review theRead rows section of the
cbtCLI reference to familiarize yourself with thecommand-line syntax and options available for sending acbt readrequestto your table. Note that thecbtCLI does not support filters. - Ensure that you have
bigtable.tables.readRowspermission for the tableor that you are a principal of thebigtable.readerrole.
Run your query
Create a query using the syntax forRead rows.
Run the following command. The
include-stats=fullparameter tellsBigtable to return the query stats.cbt readTABLE_IDQUERY include-stats=fullReplace the following:
TABLE_ID: the unique ID for the table that you arequeryingQUERY: acbtCLI-formatted query
The terminal displays the data that was read and a list containing thefollowing stats:
rows_seen_count: the number of rows that Bigtableprocessed for the requestrows_returned_count: the number of rows returned after applying filterscells_seen_count: the number of cells processed for the requestcells_returned_count: the number of cells returned after applyingfiltersfrontend_server_latency: request latency measured from theBigtable front-end server pool, expressed in milliseconds
Interpret the results
Look at the ratio of cells seen to cells returned. If the quotient for
cells_seen_count/cells_returned_countis 1 or close to 1, that's anindication that your query didn't cause Bigtable to process datathat was ultimately filtered out.Consider the number of rows returned. The higher that number is, the more workthat Bigtable is doing. The optimal number here is dependent onyour use case and latency requirements, but in general, a query that returnsfewer rows will have lower latency.
Example
If you want to get query stats when you read all rows that match the regularexpressionorange:*.* in a table calledmy-table, you can run thefollowing:
cbtreadmy-tableregex='.*orange'columns='.*:.*'include-stats=fullThe output is similar to the following:
---------------------------------------- orange Details:Color @ 2022/09/26-14:48:01.286000 "orange" Details:Size @ 2022/09/26-14:48:01.286000 "medium" Request Stats ==================== rows_seen_count: 10 rows_returned_count : 1 cells_seen_count: 2 cells_returned_count: 2 frontend_server_latency: 13msWhat's next
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.