Skip to content

Commit

Permalink
Merge pull request #4413 from szarnyasg/nits-20241218e
Browse files Browse the repository at this point in the history
Order preservation: Add new entry
  • Loading branch information
szarnyasg authored Dec 18, 2024
2 parents 03cff8d + e18d6e6 commit a739b4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/sql/dialect/order_preservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The following clauses guarantee that the original row order is preserved:
* `UNION ALL`
* `WHERE`
* Window functions with an empty `OVER` clause
* Common table expressions and table subqueries as long as they only contains the aforementioned components

> Tip `row_number() OVER ()` allows turning the original row order into an explicit column that can be referenced in the operations that don't preserve row order by default. On materialized tables, the `rowid` pseudo-column can be used to the same effect.
Expand All @@ -62,6 +63,7 @@ The following operations **do not** guarantee that the row order is preserved:
* `USING SAMPLE`
* `GROUP BY` (in particular, the output order is undefined and the order in which rows are fed into [order-sensitive aggregate functions](https://duckdb.org/docs/sql/functions/aggregates.html#order-by-clause-in-aggregate-functions) is undefined unless explicitly specified in the aggregate function)
* `ORDER BY` (specifically, `ORDER BY` may not use a [stable algorithm](https://en.m.wikipedia.org/wiki/Stable_algorithm))
* Scalar subqueries

## Insertion Order

Expand Down

0 comments on commit a739b4c

Please sign in to comment.