This is an automated email from the ASF dual-hosted git repository.
jark pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss.git
The following commit(s) were added to refs/heads/main by this push:
new 56a87232d [docs] Add documentation for COUNT(*) aggregation on primary
key table (#2687)
56a87232d is described below
commit 56a87232dc578640a8fe30d94bf55fa6e3ed7a57
Author: Jark Wu <[email protected]>
AuthorDate: Wed Feb 18 09:15:26 2026 +0800
[docs] Add documentation for COUNT(*) aggregation on primary key table
(#2687)
---
website/docs/apis/java-client.md | 14 ++++++++++++++
website/docs/engine-flink/reads.md | 17 +++++++++++++----
website/docs/quickstart/flink.md | 21 ++++++++++++++++++++-
3 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/website/docs/apis/java-client.md b/website/docs/apis/java-client.md
index 3238137df..80553889b 100644
--- a/website/docs/apis/java-client.md
+++ b/website/docs/apis/java-client.md
@@ -144,6 +144,20 @@ TableInfo tableInfo = admin.getTableInfo(tablePath).get();
// blocking call
System.out.println(tableInfo);
```
+## Table Statistics
+
+The Admin API provides the `getTableStats` method to retrieve statistics about
a table, such as the current row count.
+
+```java
+TablePath tablePath = TablePath.of("my_db", "user_table");
+TableStats stats = admin.getTableStats(tablePath).get();
+System.out.println("Row count: " + stats.getRowCount());
+```
+
+:::note
+`getTableStats` for Primary Key Tables requires the table to use the default
changelog mode (`'table.changelog.image' = 'FULL'`). Tables configured with
`'table.changelog.image' = 'WAL'` do not support this feature.
+:::
+
## Table API
### Writers
In order to write data to Fluss tables, first you need to create a Table
instance.
diff --git a/website/docs/engine-flink/reads.md
b/website/docs/engine-flink/reads.md
index 4cab45fbd..aa5c15b0b 100644
--- a/website/docs/engine-flink/reads.md
+++ b/website/docs/engine-flink/reads.md
@@ -238,20 +238,29 @@ SELECT * FROM pk_table WHERE c_custkey = 1;
```
### Aggregations
-The Fluss source supports pushdown count aggregation for the log table in
batch mode. It is useful to preview the total number of the log table;
+The Fluss source supports pushdown `COUNT(*)` aggregation in batch mode for
both **Log Tables** and **Primary Key Tables**. This feature enables efficient
row counting without scanning all records.
+
+#### Example for Log Table
```sql title="Flink SQL"
-- Execute the flink job in batch mode for current session context
SET 'execution.runtime-mode' = 'batch';
+SET 'sql-client.execution.result-mode' = 'tableau';
+
+SELECT COUNT(*) FROM log_table;
```
+#### Example for Primary Key Table
```sql title="Flink SQL"
+SET 'execution.runtime-mode' = 'batch';
SET 'sql-client.execution.result-mode' = 'tableau';
-```
-```sql title="Flink SQL"
-SELECT COUNT(*) FROM log_table;
+SELECT COUNT(*) FROM pk_table;
```
+:::note
+`COUNT(*)` pushdown for Primary Key Tables requires the table to use the
default changelog mode (`'table.changelog.image' = 'FULL'`). Tables configured
with `'table.changelog.image' = 'WAL'` do not support this feature.
+:::
+
## Read Options
diff --git a/website/docs/quickstart/flink.md b/website/docs/quickstart/flink.md
index 9e7d61c7c..f94161f56 100644
--- a/website/docs/quickstart/flink.md
+++ b/website/docs/quickstart/flink.md
@@ -397,7 +397,26 @@ SELECT * FROM enriched_orders LIMIT 2;
| 10715776 | 2 | 924.43 | 2024-11-04 | medium | Clerk3 |
Rita Booke | (925) 775-0717 | 172.39 | FURNITURE | UNITED |
+-----------+----------+-------------+------------+----------------+--------+------------+----------------+--------------+-----------------+-------------+
```
-If you are interested in a specific customer, you can retrieve their details
by performing a lookup on the `cust_key`.
+
+To quickly get the total number of rows in a table, you can use `COUNT(*)`:
+```sql title="Flink SQL"
+-- count total rows in the table
+SELECT COUNT(*) FROM enriched_orders;
+```
+
+**Sample Output**
+```
++--------+
+| EXPR$0 |
++--------+
+| 200 |
++--------+
+```
+
+You can execute this `COUNT(*)` query multiple times. Because Fluss ingests
data continuously in real time, the result will reflect the latest row count
and may increase with each execution, but the max count value should be `10000`
as the total number of the `source_order` source is `10000` rows.
+The query should return very quickly, as Fluss maintains table-level
statistics that enable efficient aggregation without scanning the entire
dataset.
+
+If you are interested in a specific customer, you can retrieve their details
by performing a lookup on the `cust_key`.
```sql title="Flink SQL"
-- lookup by primary key