170 karma · joined October 15, 2021
Postgres is a row store engine rather than a column store, so I believe there will need to be quite a lot of translation for Postgres to be able to process parquet data (DuckDB and parquet are both columnar). My hypothesis is that DuckDB would be significantly faster! However, feel free to benchmark things!
The first option is to create a macro: https://duckdb.org/docs/sql/statements/create_macro
The second is Python-specific, but you can have UDF's straight from Python! It's on the roadmap to scale this to the other supported languages. https://github.com/duckdb/duckdb/pull/1569
In general, I also think that SQL is still abstracting a lot of the complexity you would have to handle in an imperative language. These holistic moving averages are actually a great example of why I love SQL! I just learn the WINDOW functions syntax once and it works for many queries.
select * from 'https://shell.duckdb.org/data/tpch/0_01/parquet/orders.parqu...' limit 10;
https://duckdb.org/2021/05/14/sql-on-pandas.html
DuckDB is often faster than Pandas, and it can handle larger than memory data. Plus, if you already know SQL, you don't have to become a Pandas expert to be productive in Python data munging. Pandas is still good, but now you can mix and match with SQL!