TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Comparing SQLite, DuckDB and Arrow with UN trade data

246 点作者 marcle超过 3 年前

19 条评论

chrisjc超过 3 年前
I&#x27;m a little confused with Arrow being included in the comparison.<p>What does Arrow have to do with Parquet? We are talking about the file format Parquet, right? Does Arrow use Parquet as its default data storage format?<p>But isn&#x27;t Arrow a format too? As I understand it, Arrow is a format optimized for transferring in-memory data from one distributed system to another (ser-des), while also facilitating and optimizing certain set operations. From RAM in one system to RAM in another.<p>Moreover, since Arrow is a format, why is it being compared to databases like SQLite and DuckDB? If we&#x27;re talking about formats, why not compare Arrow queries against Parquet data to DuckDB queries against Parquet data? <a href="https:&#x2F;&#x2F;duckdb.org&#x2F;docs&#x2F;data&#x2F;parquet" rel="nofollow">https:&#x2F;&#x2F;duckdb.org&#x2F;docs&#x2F;data&#x2F;parquet</a><p>Why not at least benchmark the query execution alone instead of startup and loading of data? For Arrow, isn&#x27;t it assumed that there is an engine like Spark or Snowflake already up and running that&#x27;s serving you data in the Arrow format? Ideally, with Arrow you should never be dealing with data starting in a resting format like Parquet. The data should already be in RAM to reap the benefits of Arrow. Its value proposition is it&#x27;ll get &quot;live&quot; data from point A to B as efficiently as possible, in an open, non-proprietary, ubiquitous (eventually) format.<p>Exactly what of SQLite, DuckDB and Arrow is being compared here?<p>I would assume the benefits of Arrow in R (or DataFrames in general) would be getting data from a data engine into your DataFrame runtime as efficiently as possible. (just as interesting might be where and how push-downs are handled)<p>Perhaps I&#x27;m missing the trees for the forest?<p>No disrespect to the author... Seems like they&#x27;re on a quest for knowledge, and while the article is confusing to me, it certainly got me thinking.<p>Disclaimer: I don&#x27;t read R too good, and I&#x27;m still struggling with what exactly Arrow is. (Comparisons like this actually leave me even more confused about what Arrow is)
评论 #29011463 未加载
评论 #29011150 未加载
评论 #29011188 未加载
评论 #29012132 未加载
isoprophlex超过 3 年前
The relevant results from the linked article:<p><pre><code> ## format median_time mem_alloc ## 1 R (RDS) 1.34m 4.08GB ## 2 SQL (SQLite) 5.48s 6.17MB ## 3 SQL (DuckDB) 1.76s 104.66KB ## 4 Arrow (Parquet) 1.36s 453.89MB </code></pre> I&#x27;d bet that doing the same with Pandas would require time and space similar to RDS (1). I really hope DuckDB makes it in the Python world, everything I read about it seems very promising. Using it myself for toy projects was pleasant, too.
评论 #29010657 未加载
评论 #29015137 未加载
评论 #29010639 未加载
评论 #29011369 未加载
评论 #29010822 未加载
评论 #29010407 未加载
kristjansson超过 3 年前
Lots of confusion derives from the best-of-breed parquet readers for Python and R residing in the Arrow packages, mostly because Arrow is (and does) a lot of things.<p>There&#x27;s:<p>* arrow, a in-memory format for dataframe-shaped things supporting fast computation, zero-copy sharing, etc.<p>* arrow Feather V1, an on-disk format for dataframe-shaped things<p>* arrow IPC, a (de)serialization for arrow buffers and a protocol for sending&#x2F;receiving to other processes.<p>* arrow Feather V2, an on-disk format that&#x27;s basically the IPC serialization written to file[1]<p>* arrow Flight, a protocol for requesting&#x2F;sending&#x2F;receiving data to remote machines that&#x27;s basically gRPC layered over the IPC format<p>* arrow DataFusion&#x2F;Ballista, nascent system(s) for local&#x2F;distributed query execution over arrow buffers<p>* other subprojects I&#x27;m surely forgetting<p>* a (very good) C++ Parquet reader [2]&#x2F;[3] developed under the auspices of the project<p>* libraries in &#x2F; bindings to many languages, including R and Python, supporting interaction with (subsets of) the above.<p>It&#x27;s only the last piece that&#x27;s exposed to most data-science-y users, and thus identified with the &#x27;arrow&#x27; name. Since those libraries are also very good, and hiding their abstractions well, those users are free to use the functionality relevant to them, be it dealing with parquet, feather, etc. without needing to understand how they work.<p>Not that this is a criticism of the project, or those users! Arrow encompasses lots of different functionality, which enables it to provide different things to different people. As a result, though, &#x27;Arrow&#x27; connotes lots of different things (and different _sorts_ of things) to different users, which can cause some confusion if terms aren&#x27;t fully specified, or even a bit misunderstood<p>[1] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;67911190&#x2F;881025" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;67911190&#x2F;881025</a> [2] <a href="https:&#x2F;&#x2F;github.com&#x2F;apache&#x2F;parquet-cpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;apache&#x2F;parquet-cpp</a> [3] <a href="https:&#x2F;&#x2F;github.com&#x2F;apache&#x2F;arrow&#x2F;tree&#x2F;master&#x2F;cpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;apache&#x2F;arrow&#x2F;tree&#x2F;master&#x2F;cpp</a>
dgudkov超过 3 年前
DuckDB is faster than SQLite on an analytical type of query. That&#x27;s expected because DuckDB is column-based and designed exactly for this type of queries.<p>The analysis would be more telling if it measured insert performance as well.
评论 #29011597 未加载
评论 #29015289 未加载
cosmaioan超过 3 年前
I would be curios to see DuckDB with parquet <a href="https:&#x2F;&#x2F;duckdb.org&#x2F;docs&#x2F;data&#x2F;parquet" rel="nofollow">https:&#x2F;&#x2F;duckdb.org&#x2F;docs&#x2F;data&#x2F;parquet</a>
评论 #29011913 未加载
ryndbfsrw超过 3 年前
I am certain I&#x27;m in the wrong here but I&#x27;m struggling to understand Arrow&#x27;s USP. I (originally) assumed it meant python&#x2F;R users would be able to get around memory limitations when model-fitting but all the examples I&#x27;ve come across are just data manipulation and none of the main modeling packages support it. Those who are using it, what am I missing?
评论 #29010798 未加载
评论 #29012286 未加载
评论 #29012649 未加载
评论 #29011364 未加载
评论 #29012194 未加载
einpoklum超过 3 年前
Note that:<p>* The comparison used a single, simple, query: filter, group by, and sum.<p>* The comparison does not include repeated multiple queries (similar or dissimilar).<p>* A moderate amount of data is used.<p>This is certainly relevant and important, but it&#x27;s not an extensive comparison.
评论 #29011383 未加载
homerowilson超过 3 年前
I enjoyed this comparison, thanks! Here is a related generally R-centric comparison that you might enjoy of DuckDB, dplyr, data.table, etc. applied to five data-sciency problems I wrote up a few months ago: <a href="https:&#x2F;&#x2F;github.com&#x2F;bwlewis&#x2F;duckdb_and_r" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bwlewis&#x2F;duckdb_and_r</a>
HighChaparral超过 3 年前
Possibly nothing more than a side issue, but why are the indexes being created before the bulk insert, rather than after?
评论 #29012559 未加载
knome超过 3 年前
&gt;dbSendQuery(con, &quot;CREATE INDEX year ON yrpc (year)&quot;)<p>&gt;dbSendQuery(con, &quot;CREATE INDEX reporter_iso ON yrpc (reporter_iso)&quot;)<p>would sqlite use these for the query given?<p>it seems they wouldn&#x27;t help with grouping, and the grouping seems antagonistic to filtering. if you&#x27;re trying for performance, you can avoid having the query engine refer back to the original table during processing by using a covering index that includes the data fields in addition to the query fields<p>&quot;CREATE INDEX covering (reporter_iso, year, trade_value_usd_exp, trade_value_usd_imp)&quot;<p>or maybe even something like<p>&quot;CREATE INDEX covering (reporter_iso, year, reporter_iso, trade_value_usd_exp, trade_value_usd_imp)&quot;<p>Though I&#x27;m not sure how it&#x27;s query planner would do with a duplicate column in the index.
评论 #29016581 未加载
CRConrad超过 3 年前
Here&#x27;s another HN page on an article comparing SQLite to other DBs, from just the other day :-) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7432619" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7432619</a>
mjburgess超过 3 年前
Does the R code, for eg., SQLite, actually build an SQL query?<p>This just looks like a tidyverse library comparison. I&#x27;d expect a benchmark using their own libs, rather than assuming tidyverse will have an optimal way of querying them.
评论 #29010498 未加载
marcle超过 3 年前
TLDR: Arrow and DuckDB provide fast database aggregates compared with R&#x27;s RDS format and, to an extent, SQLite.<p>It is unclear how much functionality is available for Arrow under R: any comments? It would also be interesting to see a similar benchmark for Python, which could include the embedded version of MonetDB -- an R package for MonetDB&#x2F;e is not yet available.<p>Edit: amended the TLDR to reflect jhoechtl&#x27;s and wodenokoto&#x27;s comments. SQLite provided reasonably memory efficient aggregates.
评论 #29010525 未加载
评论 #29010350 未加载
评论 #29010441 未加载
flakiness超过 3 年前
Although this article is focusing on dplyr which provides an uniform API over various data sources, I guess the choice depends more on the personal taste: Do you like staying on R &#x2F; Python or on SQL?<p>If you prefer SQL, using raw Arrow or in-memory data doesn&#x27;t make sense - Except duckdb does support SQL queries over these non-db data sources as well.<p>Anyway, R data ecosystem very rich for both R and SQL fans and I as a Python user feel a bit envious.
vertere超过 3 年前
I&#x27;m a bit surprised the DuckDB file size is that large (5x Parquet, and nearly as large as sqlite). I haven&#x27;t used DuckDB, but I thought it had columnar storage and so would have better compression.
评论 #29015435 未加载
xiaodai超过 3 年前
I think disk.frame should fare pretty well if you use the `srckeep` function.
Fiahil超过 3 年前
So DuckDB is a kind of DataFusion (<a href="https:&#x2F;&#x2F;arrow.apache.org&#x2F;datafusion&#x2F;" rel="nofollow">https:&#x2F;&#x2F;arrow.apache.org&#x2F;datafusion&#x2F;</a>) ?
评论 #29015544 未加载
评论 #29011385 未加载
评论 #29011264 未加载
WFHRenaissance超过 3 年前
Why aren&#x27;t indexes being created on the RDS instance? I know it&#x27;s out of scope based on the title, but also it&#x27;s used for comparison in the final results table.
m0zg超过 3 年前
Might as well try Arrow Feather, there&#x27;s an R binding for it. This Flatbuffers-based format can be memory mapped and it requires very little decoding. Super fast and light on resources.<p>Also, Parquet supports different encodings, some of which may be faster, denser, and&#x2F;or consume less RAM, or all of the above.