Stop Thinking, Just Do!

Sungsoo Kim's Blog

In-Process Analytical Data Management with DuckDB

tagsTags

19 March 2024


Article Source


In-Process Analytical Data Management with DuckDB

Abstract

DuckDB is a novel analytical data management system. DuckDB supports complex queries, has no external dependencies, and is deeply integrated into the Python ecosystem. Because DuckDB runs in the same process, no serialization or socket communication has to occur, making data transfer virtually instantaneous. For example, DuckDB can directly query Pandas data frames faster than Pandas itself. In our talk, we will describe the user values of DuckDB, and how it can be used to improve their day-to-day lives through automatic parallelization, efficient operators and out-of-core operations.

Data management systems and data analysts have a troubled relationship: Common systems such as Postgres or Spark are unwieldy, hard to set up and maintain, hard to transfer data in and out, and hard to integrate into complex end-to-end workflows. As a response, analysts have developed their own ecosystem of data wrangling tools such as Pandas or Polars. These tools are much more natural for analysts to use, but are limited in the amount of data they can process or the amount of automatic optimization that is supported.

DuckDB is a new analytical data management system that is built for an in-process use case. DuckDB speaks SQL, has no external dependencies, and is deeply integrated into the Python ecosystem. DuckDB is Free and Open Source software under the MIT license. DuckDB uses state-of-the art query processing techniques with vectorized execution, lightweight compression, and morsel-driven automatic parallelism. DuckDB is out-of-core capable, meaning that it is capable of not only reading datasets that are bigger than main memory. This allows for analysis of far greater datasets and in many cases removes the need to run separate infrastructure.

The “duckdb” Python package is not a client to the DuckDB system, it provides the entire database engine. DuckDB runs without any external server directly inside the Python process. Once there, DuckDB can run complex SQL queries on data frames in Pandas, Polars or PyArrow formats out-of-the box. DuckDB can also directly ingest files in Parquet, CSV or JSON formats. Because DuckDB runs in the same process, data transfer are virtually instantaneous. Conversely, DuckDB’s query results can be transferred back into data frames very cheaply, allowing direct integration with complex downstream libraries such as PyTorch or TensorFlow.

DuckDB enjoys fast-growing popularity, the Python package alone is currently downloaded around one million times a month. DuckDB has recently become the default backend of the Ibis project that offers a consistent interface in Python over a variety of data backends.

This talk is aimed at two main groups, data analysts and data engineers. For the analysts, we will explain the user values of DuckDB, and how it can be used to improve their day-to-day lives. For data engineers, we will describe DuckDB’s capabilities to become part of large automated data pipelines. The presenters for the proposed talk, Hannes Mühleisen and Mark Raasveldt are the original creators of DuckDB, they are still leading the project and are deeply familiar with its Python integration.

DuckDB: 파이썬 분석가의 든든한 파트너

DuckDB는 혁신적인 분석 데이터 관리 시스템입니다. DuckDB는 복잡한 쿼리를 지원하고 외부 의존성이 없으며 파이썬 생태계와 깊게 통합됩니다. DuckDB는 같은 프로세스에서 실행되기 때문에 데이터 전송 시 직렬화 또는 소켓 통신이 발생하지 않아 데이터 전송이 거의 순간적입니다. 예를 들어, DuckDB는 Pandas 데이터 프레임을 Pandas 자체보다 더 빨리 직접 쿼리할 수 있습니다. 이 발표에서는 DuckDB의 사용자 가치와 자동 병렬화, 효율적인 연산자 및 외부 저장소 작업을 통해 일상 생활을 어떻게 개선할 수 있는지 설명합니다.

데이터 분석의 고민, 뛰어난 솔루션 DuckDB

데이터 관리 시스템과 데이터 분석가의 관계는 복잡합니다. PostgreSQL이나 Spark와 같은 일반적인 시스템은 사용하기 불편하고 설정 및 유지 관리가 어렵고 데이터 입출력이 어렵고 복잡한 엔드투엔드 워크플로에 통합하기 어렵습니다. 이러한 문제를 해결하기 위해 분석가들은 Pandas 또는 Polars와 같은 자체 데이터 정리 도구 생태계를 개발했습니다. 이러한 도구는 분석가가 사용하기에 훨씬 더 자연스럽지만 처리할 수 있는 데이터 양이나 지원되는 자동 최적화 양이 제한적입니다.

DuckDB는 인프로세스 사용 사례를 위해 만들어진 새로운 분석 데이터 관리 시스템입니다. DuckDB는 SQL을 사용하며 외부 의존성이 없으며 파이썬 생태계와 깊게 통합됩니다. DuckDB는 MIT 라이센스 하에 무료 오픈 소스 소프트웨어입니다. DuckDB는 벡터 실행, 경량 압축 및 모셀 기반 자동 병렬화를 사용하는 최첨단 쿼리 처리 기술을 사용합니다. DuckDB는 외부 저장소 기능을 갖추고 있으므로 메인 메모리보다 큰 데이터 세트를 읽을 수 있습니다. 이를 통해 훨씬 더 큰 데이터 세트를 분석할 수 있으며 많은 경우 별도 인프라를 실행할 필요가 없습니다.

“duckdb” 파이썬 패키지는 DuckDB 시스템의 클라이언트가 아니라 전체 데이터베이스 엔진을 제공합니다. DuckDB는 외부 서버 없이 파이썬 프로세스 내부에서 직접 실행됩니다. DuckDB는 기본적으로 Pandas, Polars 또는 PyArrow 형식의 데이터 프레임에 대한 복잡한 SQL 쿼리를 실행할 수 있습니다. DuckDB는 또한 Parquet, CSV 또는 JSON 형식의 파일을 직접 ingest할 수 있습니다. DuckDB는 같은 프로세스에서 실행되기 때문에 데이터 전송이 거의 순간적입니다. 반대로 DuckDB의 쿼리 결과는 데이터 프레임으로 매우 저렴하게 다시 전송할 수 있으므로 PyTorch 또는 TensorFlow와 같은 복잡한 하류 라이브러리와 직접 통합할 수 있습니다.

DuckDB는 빠르게 성장하는 인기를 누리고 있으며, 파이썬 패키지만 현재 매달 약 100만 번 다운로드됩니다. DuckDB는 최근 다양한 데이터 백엔드에서 파이썬에서 일관된 인터페이스를 제공하는 Ibis 프로젝트의 기본 백엔드가 되었습니다.

이 발표는 주로 데이터 분석가와 데이터 엔지니어 두 그룹을 대상으로 합니다. 분석가에게는 DuckDB의 사용자 가치와 일상 생활 향상에 어떻게 사용할 수 있는지 설명합니다. 데이터 엔지니어에게는 DuckDB가 대규모 자동화 데이터 파이프라인의 일부가 될 수 있는 기능에 대해 설명합니다. 발표자 Hannes Mühleisen과 Mark Raasveldt는 DuckDB의 원래 제작자이며 현재도 프로젝트를 주도하고 있으며 파이썬 통합에 깊은 지식을 보유하고 있습니다.

Bios

Hannes Mühleisen Prof. Dr. Hannes Mühleisen is a creator of the DuckDB database management system and Co-founder and CEO of DuckDB Labs, a consulting company providing services around DuckDB. He is also a senior researcher of the Database Architectures group at the Centrum Wiskunde & Informatica (CWI), the Dutch national research lab for Mathematics and Computer Science in Amsterdam. Hannes is also Professor of Data Engineering at Radboud Universiteit Nijmegen. His’ main interest is analytical data management systems.

Mark Raasveldt CTO at DuckDB Labs


comments powered by Disqus