Earlier quoted context omitted.
The blog post doesn't really make a comparison between DuckDB and data frame libraries. It mentions that the DuckDB Python bindings can interoperate with Pandas, but it doesn't really explain why you would use DuckDB instead of Pandas, or Polars (which is both faster and more portable than Pandas).
Don't Polars and Pandas both require your entire data to fit in memory?
DuckDB – An in-process SQL OLAP database management system
71–80 of 104 posts
Re: DuckDB – An in-process SQL OLAP database management system
#72Earlier quoted context omitted.
I suppose that leads to a broader question: when should you use an in-memory database, and when should you use a data frame library? The distinction between the two seems to be getting blurry (which maybe is a good thing).
Very blurry. The answer now is just "whichever is easier for the small part of the task right now". Since duckdb happily talks arrow, you can use pandas for part of it, quickly do some SQL where that is easier (with no data copying) then switch back to pandas for something. You don't really have to choose which one to use any more.
import duckdb as db
import pandas as pd
df = pd.read_excel(“z.xlsx”)
df2 = db.query(“select * from df join ‘s3://bucket/a.parquet’ b on df.col b.col”).df()
df3 = df2.col.apply(lambda x: x)
DuckDB can refer any Pandas data frame in the namespace as a SQL object. You can query across Parquet, CSV and Pandas data frames seamlessly.Need to join Excel with Parquet with CSV? No problem. You can do it all within DuckDB.
Re: DuckDB – An in-process SQL OLAP database management system
#73DuckDB is terrific. I'm bullish on its potential for simplifying many big data pipelines. Particularly, it's plausible that DuckDB + Parquet could be used on a large SMP machine (32+ cores and 128GB+ memory) to deal with data munging for 100s of gigabytes to several terabytes, all from SQL, without dealing with Hadoop, Spark, Ray, etc. I have successfully used DuckDB like above for preparing an ML dataset from about…
I'd love to hear any real world experiences of anyone who's tried to run jobs that would usually require a spark cluster on a single machine with loads of cores and memory. How big can you go, and how does speed compare to Spark? (I'm guessing significantly faster from my experience using Duckdb on smaller machines)
There was no cluster to set up or administer using DuckDB.
Re: DuckDB – An in-process SQL OLAP database management system
#74Earlier quoted context omitted.
Don't Polars and Pandas both require your entire data to fit in memory?
Pandas doesn't. Polars I think has some lazy-loading capability, but it's not the default mode of operation and I don't think it supports all features. If DuckDB doesn't, then that's a big advantage.
Re: DuckDB – An in-process SQL OLAP database management system
#75Earlier quoted context omitted.
DuckDB is a relational OLAP store. If you want to do transformations on relational data using SQL then I think nowadays you would look at the modern data stack and do it with DBT. If you have genuinely big and unstructured data then of course you need a cluster and would reach for Spark. If you have smallish data then maybe DuckDB has a role because working with SQL is nicer than Pandas. But a lot of time you actuall…
> working with SQL is nicer than Pandas Really? I prefer working with dataframe apis. You get a nice sql-like paradigm plus all the control structures of the runtime.
Re: DuckDB – An in-process SQL OLAP database management system
#76Earlier quoted context omitted.
Pandas doesn't. Polars I think has some lazy-loading capability, but it's not the default mode of operation and I don't think it supports all features. If DuckDB doesn't, then that's a big advantage.
I think you mean that Pandas does require your entire data to fit in memory? https://pandas.pydata.org/docs/user_guide/scale.html
Re: DuckDB – An in-process SQL OLAP database management system
#77* When to not use DuckDB: Multiple concurrent processes reading from a single writable database*
So no concurrent reads? Or is it no concurrent reads while writing?
Re: DuckDB – An in-process SQL OLAP database management system
#78Earlier quoted context omitted.
Don't Polars and Pandas both require your entire data to fit in memory?
Pandas doesn't. Polars I think has some lazy-loading capability, but it's not the default mode of operation and I don't think it supports all features. If DuckDB doesn't, then that's a big advantage.
Re: DuckDB – An in-process SQL OLAP database management system
#79Re: DuckDB – An in-process SQL OLAP database management system
#80DuckDB is terrific. I'm bullish on its potential for simplifying many big data pipelines. Particularly, it's plausible that DuckDB + Parquet could be used on a large SMP machine (32+ cores and 128GB+ memory) to deal with data munging for 100s of gigabytes to several terabytes, all from SQL, without dealing with Hadoop, Spark, Ray, etc. I have successfully used DuckDB like above for preparing an ML dataset from about…
I'd love to hear any real world experiences of anyone who's tried to run jobs that would usually require a spark cluster on a single machine with loads of cores and memory. How big can you go, and how does speed compare to Spark? (I'm guessing significantly faster from my experience using Duckdb on smaller machines)