Athena
Count

Cached row count (COUNT query or table reference)

Returns a single row count using the same cache layers as gateway fetch (in-process + Redis when configured). Provide either validated `query` (single SELECT COUNT ... with no GROUP BY / UNION / comments) or `table_name` with optional `table_schema` (default `public`). `Cache-Control: no-cache` bypasses the cache. Responses include `X-Athena-Cached`, `X-Athena-Cache-Outcome`, and `X-Athena-Cache-Source` when applicable.

POST
/query/count

Header Parameters

X-Athena-Client?string

Required when driver is postgresql

Cache-Control?string

Set to no-cache to bypass cached count

Request Body

application/json

driver*string
Value in"athena" | "postgresql" | "supabase"
db_name*string
query?string

Validated COUNT-only SQL (mutually exclusive with table_name)

table_name?string

Table name when not using raw query (mutually exclusive with query)

table_schema?string

Schema name; defaults to public when using table_name

Response Body

application/json

curl -X POST "https://athena-cluster.com/query/count" \  -H "Content-Type: application/json" \  -d '{    "driver": "postgresql",    "db_name": "athena_logging",    "table_name": "http_request_log",    "table_schema": "public"  }'
{
  "status": "success",
  "message": "Row count computed",
  "data": {
    "count": 2451,
    "db_name": "athena_logging",
    "duration_ms": 12,
    "cache_lookup_outcome": "hit_local"
  }
}
Empty
Empty
Empty