Path: blob/main/docs/source/polars-cloud/run/distributed-engine.md
8354 views
Distributed queries
With the introduction of Polars Cloud, we also introduced the distributed engine. This engine enables users to horizontally scale workloads across multiple machines.
Polars has always been optimized for fast and efficient performance on a single machine. However, when querying large datasets from cloud storage, performance is often constrained by the I/O limitations of a single node. By scaling horizontally, these download limitations can be significantly reduced, allowing users to process data at scale.
!!! info "Distributed engine is in open beta"
Using distributed engine
To execute queries using the distributed engine, you can call the distributed() method.
Example
This example demonstrates running query 3 of the PDS-H benchmarkon scale factor 100 (approx. 100GB of data) using Polars Cloud distributed engine.
!!! note "Run the example yourself"
First import the required packages and point to the S3 bucket. In this example, we take one of the PDS-H benchmarks queries for demonstration purposes.
{{code_block('polars-cloud/distributed','setup',[])}}
After that we define the query. Note that this query will also run on your local machine if you have the data available. You can generate the data with the Polars Benchmark repository.
{{code_block('polars-cloud/distributed','query',[])}}
The final step is to set the compute context and run the query. Here we're using 5 nodes with 10 CPUs and 10GB memory each. Show() will return the first 10 rows back to your environment. The query takes around xx seconds to execute.
{{code_block('polars-cloud/distributed','context-run',[])}}
!!! tip "Try on SF1000 (approx. 1TB of data)"