AppsAutessaDB

Queries, APIs and SDKs · AutessaDB

Aggregations

AutessaDB aggregates run on the server: filter rows, group by a few columns, and compute COUNT, SUM, AVG, MIN and MAX, each under its own alias. HAVING filters the groups, orderBy sorts them, and a limit caps how many come back.

A database essential, built in
aggregateSAMPLE
groupBy: ["status"]
aggregates: [{ "function": "COUNT", "alias": "count" },
             { "function": "AVG", "column": "age_hours", "alias": "avg_age" }]
having: [{ "alias": "count", "operator": ">", "value": 5 }]
groupsSAMPLE
open48 · 31h
waiting22 · 54h
escalated9 · 12h

-- the problem

Counting rows in the client does not scale

Pulling every row to count tickets by status is slow, expensive and, if security trims rows, quietly wrong. Server-side aggregation counts only what the caller may see and returns just the totals.

What you get

  • Functions: COUNT, SUM, AVG, MIN and MAX; COUNT can omit the column to count rows.
  • Group by a small number of columns, or omit groupBy to total the whole filtered set.
  • HAVING compares an alias with =, !=, >, <, >= or <=, and multiple conditions are combined with AND.
  • Sort by a group column or an aggregate alias.
  • Hidden columns are treated as not existing, and masked columns cannot be grouped or aggregated.
  • Agents get the same capability through the Aggregate tool type.

-- how it works

How does aggregations work in AutessaDB?

  1. Filter

    Start with whereGroups to choose which rows count.

  2. Group and compute

    Pick groupBy columns and the aggregates, each with a unique alias.

  3. Refine

    Add having, orderBy and limit to shape the result.

-- every option

Aggregate request

optionwhat it does
whereGroupsOptional pre-aggregation filter, same shape as query.
groupByColumns to group by (a small maximum applies).
aggregates{ function, column, alias }, with a unique alias each.
havingFilters on aliases, ANDed together.
orderBy / limitSort groups and cap how many return.

-- example

An agent Aggregate tooljson
{
  "toolType": "AUTESSADB_AGGREGATE",
  "tableId": "V1StGXR8Z5",
  "groupBy": ["status"],
  "aggregates": [
    { "function": "COUNT", "alias": "count" },
    { "function": "AVG", "column": "age", "alias": "avg_age" }
  ],
  "orderBy": [{ "columnName": "count", "direction": "DESC" }]
}

Full reference in the AutessaDB CLI docs and the API reference.

-- permissions

Who can do what?

accesscan
READRun aggregates over rows the caller can see.

-- relations

How it connects

-- faq

Questions about aggregations

Which aggregate functions are available?

COUNT, SUM, AVG, MIN and MAX on regular tables. The data lake adds full analytical SQL, including window functions.

Do aggregates respect row security?

Yes. They count only rows the caller can see, and refuse to group or aggregate columns the caller sees only as a mask.

Can I filter on the aggregate result?

Yes, with having, which compares an alias to a number.

$ autessa autessadb tables create

Try aggregations in AutessaDB

Group rows by a few columns and compute COUNT, SUM, AVG, MIN and MAX on the server, filtering the groups with HAVING.

Read the AutessaDB guide or install the CLI.

100% customizable, code and all

Make AutessaDB fully your own.

Use it out of the box, then change anything. Ask Autobot, Autessa’s AI builder, for a new field, screen, report, workflow or agent and it builds it into your copy of the app. Or open the code and edit it yourself. Nothing is locked: the app, its data and its code are yours.

Start free and make it yours