tail() function

tail() limits each output table to the last n rows.

tail() produces one output table for each input table. Each output table contains the last n records before the offset. If the input table has less than offset + n records, tail() outputs all records before the offset.

Function type signature
(<-tables: stream[A], n: int, ?offset: int) => stream[A]
For more information, see Function type signatures.



(Required) Maximum number of rows to output.


Number of records to skip at the end of a table table before limiting to n. Default is 0.


Input data. Default is piped-forward data (<-).


Output the last three rows in each input table

import "sampledata"
    |> tail(n: 3)

View example input and output

Output the last three rows before the last row in each input table

import "sampledata"
    |> tail(n: 3, offset: 1)

View example input and output

Was this page helpful?

Thank you for your feedback!

Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.