# ความโหดของ DuckDB หาผลรวม 3 columns กับข้อมูลจำนวน 17 ล้านแถวได้ในเวลา.. 206ms

**URL:** <https://discuss.dataengineercafe.io/t/duckdb-3-columns-17-206ms/429>\
**Category:** พูดคุยเกี่ยวกับ Data Tools ต่าง ๆ\
**Tags:** duckdb, performance\
**Created:** [October 7, 2022, 2:15pm UTC](https://discuss.dataengineercafe.io/t/duckdb-3-columns-17-206ms/429 "2022-10-07T14:15:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/zkan/32/2_2.png) [@zkan](https://discuss.dataengineercafe.io/u/zkan)\
**Post date:** [October 7, 2022, 2:15pm UTC](https://discuss.dataengineercafe.io/t/duckdb-3-columns-17-206ms/429/1 "2022-10-07T14:15:13Z")

</div>

มีคนลองเล่น DuckDB กับข้อมูลขนาดประมาณ 3GB (68 ไฟล์ที่เก็บในฟอร์แมต [Parquet](https://parquet.apache.org/))

> **[Using DuckDB in Python to access Parquet data](https://til.simonwillison.net/duckdb/parquet)**
>
> Did a quick experiment with DuckDB today, inspired by the bmschmidt/hathi-binary repo.

เค้าลองหาผลรวมเล่น ๆ กับ 3 columns และนี่คือผลที่ได้… 😱

> 206ms to sum three columns across 17 million records is pretty fast!

น้องเป็ด 🦆 นี่จะโหดไปไหนเนี่ย 😂 ส่วนใครที่ยังไม่รู้จักน้องเป็ดนี่ ตามไปอ่านโพสต์ด้านล่างนี้ได้นะ

> [@มารู้จัก DuckDB กัน duck ฐานข้อมูล สำหรับการวิเคราะห์บนเครื่อง Local](https://discuss.dataengineercafe.io/t/duckdb-local/129):
>
> เจ้าเป็ด [DuckDB](https://duckdb.org/) ฐานข้อมูลน่ารักๆ ใช้งานง่าย และมีประสิทธิภาพสูง duck muscle [DuckDB] ทำไมต้อง DuckDB? [Why DuckDB?] ง่าย! เค้าได้ไอเดียมาจาก SQLite ที่เป็นฐานข้อมูลที่ไม่ว่าใครก็ตามจะทำ app หรือจะวิเคราะห์ข้อมูล สามารถใช้งานมันได้ง่ายมาก โดยที่เราไม่จำเป็นต้องไปตั้ง server เอง (ซึ่งถ้ามี server อยู่แล้วก็ไปใช้ server ดีกว่านะ) และเค้าก็บอกว่าเราไม่จำเป็นต้องไปติดตั้ง external dependencies เพิ่มอีกด้วย star_struck ตัวมันเองแฝงตัวอยู่ใน host process อยู่แล้ว ไม่ได้รันแยกออกไปอีก process …

---

<div class="post-metadata">

**Author:** ![fonylew](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/fonylew/32/300_2.png) [@fonylew](https://discuss.dataengineercafe.io/u/fonylew)\
**Post date:** [October 29, 2022, 3:08pm UTC](https://discuss.dataengineercafe.io/t/duckdb-3-columns-17-206ms/429/2 "2022-10-29T15:08:41Z")

</div>

โหดมากค่ะ ใช้กับ CSV ได้ด้วย ประทับใจมากๆ เร็วกว่ามานั่ง import เข้า Excel แน่นอนค่ะ 5555  
แถมยังใช้ wildcard (`*`) กับชื่อไฟล์หลาย ๆ ไฟล์ได้อีก  
เหมาะกับการเปิดไฟล์ locally มากค่ะ ใช้ผ่าน DBeaver ได้เลย แค่  
`SELECT * FROM '/Users/username/Downloads/myfile_*.csv'`
