Repository navigation
Description
In short: List endpoints accept
total=falseto skip counting the matching rows, but the SDKs send it as the text "false", which Appwrite treats as true, so the count still runs.Impact:
- The documented way to make list requests cheaper has no effect for SDK users.
- With row-level security, really skipping the count doubled throughput in our test (738 → 1,694 req/s).
- Workaround until fixed: send
total=0.
👟 Reproduction steps
-
Create a table with more than 5,000 rows.
-
Call the list endpoint with
total=false, the way the SDKs send it:curl "$ENDPOINT/v1/tablesdb/$DB/tables/$TABLE/rows?total=false" -H "X-Appwrite-Project: $PROJECT" -H "X-Appwrite-Key: $KEY" # → {"total":5000,"rows":[…]}
-
Call it with
total=0:curl "$ENDPOINT/v1/tablesdb/$DB/tables/$TABLE/rows?total=0" … # → {"total":0,"rows":[…]}
Or with the SDKs: tablesDB.listRows({ databaseId, tableId, total: false }) returns a non-zero total, and the count query runs in the database.
👍 Expected behavior
total=false skips the count and returns total: 0, as documented in the parameter description: "When set to false, the total count returned will be 0 and will not be calculated." (Rows/XList.php#L60)
👎 Actual Behavior
The string "false" passes the loose Boolean validator. The value is then handed to the action's bool $includeTotal parameter (Documents/XList.php#L90) without being converted. PHP's type juggling turns the non-empty string "false" into true, so the count runs. Only "0" or an empty value turn into false.
All official client SDKs we checked send booleans in GET query strings as the literal "false":
| SDK | Code path | Sent value |
|---|---|---|
Web (appwrite) |
url.searchParams.append(key, value) in client.ts |
total=false |
Node (node-appwrite) |
same pattern in client.ts |
total=false |
| Flutter / Dart | value.toString() for bool in client_mixin.dart |
total=false |
The E2E tests from #13991 probably pass because PHP's http_build_query() encodes false as 0, so the tests never send the string "false" (not verified).
Impact. Measured on a table with ≈ 1 M rows and Postgres:
total=falsecost the same as no parameter: 5,029 vs 5,055 tuples read per request, 1,424 vs 1,496 req/s.- With row-level security and a user who can see 52,000 rows,
total=0raised throughput from 738 to 1,694 req/s.
So users who follow the docs to save the count get no saving.
This probably affects every boolean query parameter on GET routes, not only total. We only verified total.
Suggested fix: convert "true"/"false" (and "1"/"0") to real booleans before calling the action. This belongs either in the framework where Boolean(loose: true) params are passed on, or in Appwrite's request filter. Add an E2E test that sends the literal string false.
Since when / regression?
The total parameter was introduced in 1.8.1 (#10668). We did not check 1.8.1 itself, but nothing suggests that the string "false" was ever converted. It has probably been ineffective for SDK users since it was introduced.
Risks / things to consider for the fix
- A global conversion of
"false"affects every loose boolean parameter on GET routes. Clients that today rely on the accidental"false" → truebehaviour would change behaviour. That is unlikely to be intended anywhere, but it should be mentioned in the changelog. - Accept the usual spellings (
true/false,1/0, maybe case-insensitive) and reject everything else, instead of PHP's truthiness.
Related issues from the same analysis (Appwrite 2.3.0 with Postgres, same test setup):
- 🐛 Bug Report: Two uncached team queries on every API request #14077 – every request runs two uncached queries for the project team
- 🐛 Bug Report: Postgres insert reads back
_idwith an extra query #14078 –_idread back after every insert instead ofINSERT … RETURNING - 🐛 Bug Report: Postgres adapter sets and resets
statement_timeoutaround every query #14079 –SET/RESET statement_timeoutaround every query - 🐛 Bug Report: Postgres adapter sends
ROLLBACKbefore everyBEGIN#14080 –ROLLBACKbefore everyBEGIN, Postgres log flood - 🐛 Bug Report: Postgres: fulltext search never uses an index #14081 – fulltext indexes on Postgres are plain B-trees,
searchcannot use them - 🐛 Bug Report: Pool adapter checks out a connection for every capability getter #14083 – pool adapter checks out a connection for constant capability getters
- 🐛 Bug Report: Usage queue backlog evicts the cache from Redis #14084 – usage queue backlog evicts the cache in the shared Redis
- 🐛 Bug Report: PostgreSQL adapter never uses the
_uidindex – every create, get and update by row ID scans the whole table #14075 – Postgres adapter never uses the_uidindex (collation)
🎲 Appwrite version
Version 2.3.0 (self-hosted)
💻 Operating system
Linux (Debian 12, Docker 29.8)
🧱 Your Environment
Self-hosted Appwrite 2.3.0 with PostgreSQL 18.3. The bug is in request parameter handling and does not depend on the database adapter. Related test setup: #14075.
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct
Activity
JoshiJoshiJoshi commentedon Oct 4, 2026
Follow-up from an end-to-end run: with the other fixes applied (#14075, #14077–#14079, #14083), listing a table with row-level permissions as a user who can see ≈ 26,000 rows is the one operation that stays bound by Postgres (≈ 1,050 req/s, database node at 100 % CPU).
Breaking it down on stock settings: the count for
totaltakes ≈ 97 % of that request's database time (8 ms per call vs. 0.19 ms for the page itself,pg_stat_statements). The count plan itself is fine (GIN bitmap scan, up toAPP_LIMIT_COUNT= 5,000 rows); it is simply executed on every request. Withtotal=0: 767 → ≈ 1,420 req/s (×1.9, two runs, 80 concurrent, 2 API nodes × 4 vCPU).[-]🐛 Bug Report: `total=false` on list endpoints is ignored – the count still runs (affects the Web, Node and Dart/Flutter SDKs)[/-][+]🐛 Bug Report: `total=false` on list endpoints is ignored[/+]fix(http): coerce loose boolean strings at dispatch