Polars 2.2.0 Lets Joins Outgrow Memory

Polars 2.2.0, uploaded 24 November 2026, adds out-of-core joins that spill to disk, free-threaded wheels, and three breaking changes to check before upgrading.

Polars 2.2.0 arrived on PyPI on 24 November 2026 with one item at the top of its release notes: out-of-core joins. The streaming equi-join can now finish a join whose build side is larger than the memory budget, by spilling partitions to disk and joining them one at a time. It is the only entry under Highlights in the release notes, and it is the change that decides whether this version matters to a given project. The rest of the release is a long list of performance work, a wider SQL surface, and three breaking changes that deserve a read before any upgrade. This article works from the v2.2.0 release notes, the PyPI metadata, and the pull request that implements the feature.

Polars 2.0 landed in October with streaming as the default way to run large queries, and the site covered that release in two parts: the final 2.0 release and the 2.0 release candidate. Version 2.2.0 is the second minor release of the 2.x line, and it fills in a gap that 2.0 left open. Streaming could already push work out of memory in several places, but a join still needed its build side in RAM. A join against a dimension table that fits in memory was fine. A join against a table that does not fit was a wall. Version 2.2.0 moves that wall.

The headline: joins that spill

A hash join has two sides. The build side is read first and turned into a hash table keyed on the join column. The probe side streams through afterwards, and each probe row looks up its key in the table. The build side is the part that has to live in memory, and its size sets the limit on the whole operation. Polars already had a spill-to-disk story for other operations, and its PyPI page has long advertised that operations exceeding available RAM can spill to disk. The join was the holdout, and 2.2.0 closes it for the most common case.

The change lives in the streaming engine, which is the path a lazy query takes when it runs with streaming collection. A query that runs eagerly, collecting a full DataFrame into memory first, does not get this. The feature is tied to the streaming equi-join, the join that matches rows on equality of a key. It is the join most analytical pipelines use most of the time, which is why it came first, and the release notes are specific about the boundary: semi and anti joins are not covered yet, and neither are joins that ask to keep the input order.

The release is a normal pip install polars upgrade. The PyPI files were uploaded on 24 November 2026, a 925.1 kB source distribution and a 1.0 MB wheel, both with provenance attestations. The GitHub release tag is py-2.2.0. There is no new dependency to add and no configuration flag to set before the feature is available; the streaming join decides for itself, per query, whether the build side fits.

How the spill actually works

The pull request behind the feature, numbered 30679, describes the mechanism in plain terms. It explains both what gets faster and where the costs move. Once the build side has been received, the join estimates how large its hash tables will be and asks the memory manager for a memory grant for them. If the tables fit inside the grant, nothing changes: the join builds every table in memory and runs exactly as before. The new path only starts when the tables do not fit.

When the grant is too small, the build side is split by key hash into partitions. Each partition is stored as frames that can spill to disk, and the number of partitions is chosen so that the tables of a few partitions at a time fit comfortably in memory. The smallest partitions that fit inside the grant are built straight away, so part of the join still runs in memory while the rest waits on disk. That detail matters for ordinary workloads: a join that is only slightly too large for memory does not suddenly become a fully disk-bound operation. It becomes a partly in-memory one, with the overflow parked aside.

The probe side gets the same treatment. While probe rows come in, they are split by key hash the same way. Rows that belong to a partition whose table is already in memory are probed right away and their results sent on, as before. Rows that belong to a stored partition are written into frames for that partition, which can also spill. Each stored partition ends up holding its build rows and its probe rows side by side, ready to be joined on its own once the probe input is done.

Build rows with a null key can never match anything, since a null key equals nothing, not even another null. When the join type means those rows still belong in the output, for example the preserved side of an outer join, they are set aside separately instead of being placed in a table. That keeps null handling out of the hash tables entirely.

When the probe input ends, a flush phase sends what is left. First come the unmatched build rows of the tables held in memory and the build rows with a null key. Then each stored partition is joined in turn: its table is built once the grant has room for it, it is probed with that partition’s stored probe rows, and its unmatched rows are sent if the join type requires them. As each table is finished and freed, its memory goes back to the grant, which makes room for the next partition. The whole operation runs partition by partition, and memory use stays inside the grant throughout.

Two companion changes in the same release support this. One makes the streaming equi-join build side fully spillable while it is being received, so the build side itself does not need to sit in memory before partitioning starts. The other adds a memory grant system and uses it in group-by operations, which is the same accounting the join now relies on. The release notes also list parallel streaming cumulative aggregations, quantile computation by selection instead of sorting, and a long run of smaller streaming and scan improvements. The join is the headline, but the release is really a streaming-engine release, with the join as its most visible piece.

What stays in memory

The limits in the pull request are as specific as the feature itself, and they are the part a reader should carry into an upgrade decision. The new path covers only equi-joins without maintain_order. Semi and anti joins still build their whole table in memory, and the author lists them as the natural follow-up: stored partitions could keep their rows and the flush could filter them partition by partition, but that work is not in this release. Joins with maintain_order can already spill their build input while it is being received, yet they still build every table in memory and never store probe rows. Storing partitions for them would also need the results of each partition put back in input order, which is a separate piece of work.

Skewed data is the other open edge. Each stored partition could in principle be built from whichever of its two sides is smaller, and a partition whose table cannot fit in memory, for example because one key value is extremely common, could be built in pieces by re-reading its stored probe rows for each piece. Neither is implemented. The join always builds at least one table, even if that table is larger than the grant. A join dominated by a single hot key can therefore still run out of memory, and the release notes do not promise otherwise.

There is also no benchmark attached to the feature in the release notes or the pull request, so there is no number to quote for how fast a spilling join runs or how much memory it saves on a given shape of data. That is normal for a change like this: the win is that the query finishes at all, and the speed depends on the disk underneath it, the partition count the engine picks, and how the keys are distributed. A reader planning around this feature should treat it as a capacity change first and a performance question second, and measure the second part on their own data.

The practical reading is straightforward. If a pipeline already joins tables that fit in memory, 2.2.0 changes nothing about it. If a pipeline has a join that fails or forces a manual workaround because the dimension side is too large, 2.2.0 removes the wall for the common case, as long as the join is an equi-join, the query runs through the streaming engine, and the keys are reasonably spread. Semi and anti joins against oversized tables, ordered joins, and badly skewed keys stay where they were.

Three breaking changes to read first

The release carries three breaking changes, and each one is small enough to miss in a casual upgrade. The first concerns str.find and its variants. Expr.str.find and Expr.str.find_many now return character offsets instead of byte offsets, and a new Expr.bin.find and Expr.bin.find_many cover the byte-offset case for binary data. Any code that slices a string by the offset returned from str.find was previously slicing by bytes, which only differs from characters when the text contains multi-byte characters. That is exactly the kind of difference that passes every test written in ASCII and breaks on the first real-world string with an accent or a CJK character. The fix is to check whether the code treats the result as a character position, which is now correct, or as a byte position, which needs the new binary expression.

The second change is about scalar function arguments. Scalar arguments to functions must now be given at plan time, which means the query planner needs to know them when it builds the plan rather than discovering them later. Most ordinary queries already do this, since their scalar arguments are literals written in the query. The change bites in generated or programmatic queries where a scalar value arrives late, for example through a variable that is only resolved after the plan is built. The symptom would be a planning error rather than a wrong result, which at least makes it loud.

The third change is in SQL. A SQL DELETE now changes the registered table in a SQLContext, where before it did not. Code that ran a DELETE inside a SQL context and then read the same registered table expecting the original rows will now see the deletion applied. The release notes frame it as a correction, and it aligns the behavior with what a user would expect a DELETE to do, but any workflow that relied on the old behavior, deliberately or by accident, needs a look. The rest of the SQL surface in this release moves the other way, adding capability: window frames that end before the current row, COPY, INSERT, UPDATE, MERGE INTO, and TRUNCATE on registered and Iceberg tables, SQL macros, PIVOT, UNPIVOT, and positional joins, plus scan_database for attaching a database as a source.

The rest of 2.2.0

Two other items in the release deserve attention beyond the join. The first is that 2.2.0 ships free-threaded Python wheels built on the stable ABI. Free-threaded Python, the build of CPython without the global interpreter lock, has been moving from experiment to supported option through 2026, and a library that ships wheels for it removes one more reason for a team to hold back. The stable ABI part matters too: wheels built against the stable ABI keep working across Python versions, which cuts the rebuild churn that usually follows a new interpreter release. For a data team that has been waiting to try free-threaded Python on a real workload, this is a small but concrete unblocking.

The second is the sheer volume of performance work. The release notes list well over a hundred performance items, most of them in the streaming engine and the scan layer: parallel quantile selection, quantiles computed by selection instead of sorting, packed multi-column join and group-by keys, faster Parquet decoding for small string and binary columns, and prefetch windows that follow the in-flight byte budget for cloud reads. None of these is a headline on its own. Together they are the kind of release where the engine gets faster in ways that show up as shorter runtimes on existing queries rather than as new features. The site’s earlier coverage of DuckDB and Parquet pushdown made a similar point about a different engine: the interesting work in a mature query engine is often in the scan and the plan, not in the API.

There is also a quieter theme in the enhancements list. A large share of it is SQL and catalog work: Iceberg tables get time travel, partition evolution, manifest rewrites, metadata tables, and CALL procedures for compaction, while Delta tables can now be written with the native Parquet sink. Parquet encryption properties are serializable, and a KMS can be used for Parquet encryption. The direction is clear enough: Polars is spending its effort on being a credible query layer over lakehouse tables as well as local files. That is a longer story than one release, and 2.2.0 is one more step along it.

How to check it yourself

No benchmark in this article comes from a run against 2.2.0, and none should be read as one. Everything above comes from the release notes, the PyPI record, and the implementing pull request, each linked where it is used. A reader who wants to confirm the headline can do it with three checks that need nothing more than a terminal. First, install or upgrade and confirm the version with pip install -U polars followed by python -c "import polars; print(polars.__version__)", which should print 2.2.0. Second, open the release notes and confirm that out-of-core joins are listed as the highlight and that the three breaking changes match the ones named here. Third, take a join that currently fails on memory in the streaming engine and run it again under 2.2.0, watching whether it completes and how long the spilling path takes on the reader’s own disk and data. The third check is the one that actually answers the performance question, and it is the only one that can, since the result depends on the reader’s keys, their disk, and their memory budget.

The upgrade checklist follows from the breaking changes. Search the codebase for uses of str.find and str.find_many and decide whether each result is used as a character offset or a byte offset. Search for scalar arguments built dynamically in generated queries and confirm they resolve at plan time. Search for SQL DELETE statements run through a SQLContext and confirm the table is expected to change. Then upgrade in a test environment first, run the streaming queries that matter, and only then move the pin. The release is a minor version, and most projects will upgrade without touching anything, but the three breaking changes are exactly the kind that hide in code that looks fine until it meets real data.

Polars 2.2.0 is a capacity release dressed as a minor version. The join that used to need the whole build side in memory now needs only a few partitions at a time, and the rest can wait on disk. Semi and anti joins, ordered joins, and skewed keys are still waiting for their turn, and there is no published number for how fast the spilling path runs. What the release does give, on the record, is a streaming engine that finishes a class of queries it used to refuse, plus free-threaded wheels and a SQL surface that keeps growing toward lakehouse work. The PyPI files are up, the tag is py-2.2.0, and the next step for any team with a too-large join is to try it on their own data.

Share this article

X Facebook LinkedIn Reddit Telegram

Your notes on this article

Your name or initials, note and date stay in this browser profile. Anyone using the profile can read them. Delete a note below or clear this site’s browser data. To reach the editors, report a correction.

No notes saved here