count
This page explains how to use the count operator function in APL.
The count
operator in Axiom Processing Language (APL) is a simple yet powerful aggregation function that returns the total number of records in a dataset. You can use it to calculate the number of rows in a table or the results of a query. The count
operator is useful in scenarios such as log analysis, telemetry data processing, and security monitoring, where you need to know how many events, transactions, or data entries match certain criteria.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
Usage
Syntax
Parameters
The count
operator does not take any parameters. It simply returns the number of records in the dataset or query result.
Returns
count
returns an integer representing the total number of records in the dataset.
Use case examples
In this example, you count the total number of HTTP requests in the ['sample-http-logs']
dataset.
Query
Output
count |
---|
15000 |
This query returns the total number of HTTP requests recorded in the logs.
List of related operators
- summarize: The
summarize
operator is used to aggregate data based on one or more fields, allowing you to calculate sums, averages, and other statistics, including counts. Usesummarize
when you need to group data before counting. - extend: The
extend
operator adds calculated fields to a dataset. You can useextend
alongsidecount
if you want to add additional calculated data to your query results. - project: The
project
operator selects specific fields from a dataset. Whilecount
returns the total number of records,project
can limit or change which fields you see. - where: The
where
operator filters rows based on a condition. Usewhere
withcount
to only count records that meet certain criteria. - take: The
take
operator returns a specified number of records. You can usetake
to limit results before applyingcount
if you’re interested in counting a sample of records.