You are viewing the documentation of an older version of the TiDB database (TiDB v5.4). It is recommended that you use the latest LTS version of the TiDB database.
Window Functions
The usage of window functions in TiDB is similar to that in MySQL 8.0. For details, see MySQL Window Functions.
Because window functions reserve additional words in the parser, TiDB provides an option to disable window functions. If you receive errors parsing SQL statements after upgrading, try setting tidb_enable_window_function=0.
Except for GROUP_CONCAT() and APPROX_PERCENTILE(), TiDB supports all GROUP BY aggregate functions. In addition, TiDB supports the following window functions:
Divides a partition into N buckets, assigns the bucket number to each row in the partition, and returns the bucket number of the current row within the partition.