Skip to content

🐛 Bug Report: total=false on list endpoints is ignored #14082

Open

Description

@JoshiJoshiJoshi

In short: List endpoints accept total=false to 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

  1. Create a table with more than 5,000 rows.

  2. 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":[…]}
  3. 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=false cost 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=0 raised 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" → true behaviour 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):

🎲 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?

Activity

  1. added
    product / auth
    product / databases
    product / self-hosted
    sdk / cli
    on Oct 3, 2026
  2. JoshiJoshiJoshi commented on Oct 4, 2026

    @JoshiJoshiJoshi
    Author

    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 total takes ≈ 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 to APP_LIMIT_COUNT = 5,000 rows); it is simply executed on every request. With total=0: 767 → ≈ 1,420 req/s (×1.9, two runs, 80 concurrent, 2 API nodes × 4 vCPU).

  3. changed the title [-]🐛 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[/+] on Oct 4, 2026
  4. added a commit that references this issue on Oct 7, 2026
    b18dd0d
  5. removed
    product / auth
    product / self-hosted
    sdk / cli
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    product / databases

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions