v.19.14New Feature

WITH TIES Modifier for LIMIT

WITH TIES modifier for LIMIT. (continuation of #5069) #6610 (Anton Popov)
Introduces the WITH TIES modifier for the LIMIT clause, enabling users to include additional rows that tie with the last row according to the ORDER BY expression.

Why it matters

This feature addresses the limitation of the standard LIMIT clause by allowing retrieval of all rows that share the same ordering value as the last row within the limit. It is valuable for accurately capturing tied results in sorted datasets without arbitrary truncation.

How to use it

To use this feature, append WITH TIES to your LIMIT clause in a query with an ORDER BY clause. For example:

SELECT * FROM table_name
ORDER BY column_name
LIMIT 10 WITH TIES