REST from your database catalog
    DocumentationCheat sheetQuestionsDownloadSource
    Questions
    • How do I...?
    Start here
    • Getting started
    • What a table becomes
    • Compared with PostgREST
    Setting up
    • Tables, columns and relations
    • Security and hooks
    • Writes and procedures
    • Prefer: return=representation
    • Node, Fastify, Express
    Reading
    • select
    • /{key}
    • relation(...)
    • order
    • limit, offset
    • relation.order, .limit
    • count
    • count(), sum(), avg()...
    • "name"
    Filtering
    • eq, neq
    • gt, gte, lt, lte
    • in
    • like, ilike
    • match, imatch
    • is
    • ov, cs, cd
    • not
    • relation.column
    • or, and
    Databases
    • Supported databases
    • Adding a database
    Reference
    • Cheat sheet
    • Errors
    Reading

    Know how many there are

    Ask for count=exact to get the total number of matching rows in the Content-Range header.

    count=exactcount=estimated

    Every list answers a Content-Range header such as 0-1/*: rows 0 to 1 were sent, total unknown. An empty page answers */0. With count=exact, the * becomes the total, so a client can draw page numbers.

    count=estimated asks for the planner's estimate, which is much cheaper on a large PostgreSQL table. A database without estimates, like the SQLite in this page, counts exactly instead.

    Examples

    One row sent, out of three open todos: Content-Range 0-0/3.
    /todos?select=name&status=eq.open&limit=1&count=exact

    Asking the database...

    See alsoRead a page Totals per group
    PreviousSort and page what is embeddedNext Totals per group
    restloom - a REST API generated from your database catalog
    DocumentationDownloadSource