Live data from Hacker News

DuckDB Isn't Just Fast

csvbase.com

11–20 of 40 posts

Re: DuckDB Isn't Just Fast

#11

uhm why would you ever use this instead of sqlite

DuckDB is optimised for analytical tasks, whereas SQLite isn't.

For those not aware: analytical tasks involve a lot of groupings, aggregations, running sums/averages, sorting, ranking etc. Columnar databases like duckdb are more focused on those tasks so you can do these tasks much faster.

Re: DuckDB Isn't Just Fast

#12
post #4

I know I'm repeating my self (it must be my third comment on HN about this topic), but this does not match my experience at all. DuckDB will error-out with an out-of-memory exception in very simple DISTINCT ON / GROUP BY queries. Even with a temporary file, an on-disk database and not keeping the initial order. On any version of DuckDB.

Curious about your post, and DuckDB, since have seen many previous post here on HN about it...I just took 10 min to do some quick tests, and experiment with DuckDB for the first time. :-)

While I am a Linux user, tried this on a available Windows 10 machine (I know...Yuck!)

1) Setup and install no prob. Tracked the duckdb process memory usage with PowerShell, like this:

  Get-Process -Name duckdb | Select-Object Name, @{Name="Memory (MB)";Expression={[math]::round($_.WorkingSet64/1MB,2)}}
2) Used this simulated netflix table dataset available from an S3 bucket, as used in this example blog. Installed the aws extension not the one mentioned in the blog: https://motherduck.com/blog/duckdb-tutorial-for-beginners/

Section in the blog: "FIRST ANALYTICS PROJECT"

Table has 7100 rows as seen like this:

   SELECT COUNT(*) AS RowCount FROM netflix;
3) Did 8 different queries using DISTINCT ON / GROUP BY

   The one below, being one example:

    SELECT DISTINCT ON (Title) 
      Title, 
      "As of", 
      Rank 
    FROM netflix 
    ORDER BY Title, "As of" DESC;
I am not seeing any out of memory or memory leak from these quick tests.

I also tested, with the parquet file from the thread mentioned below by mgt19937. It is 89475 rows. Did some complex DISTINCT ON / GROUP BY on it, without seeing neither explosive memory use or something similar to a memory leak.

Do you have a more specific example?

Re: DuckDB Isn't Just Fast

#13

Earlier quoted context omitted.

DuckDB is optimised for analytical tasks, whereas SQLite isn't.

For those not aware: analytical tasks involve a lot of groupings, aggregations, running sums/averages, sorting, ranking etc. Columnar databases like duckdb are more focused on those tasks so you can do these tasks much faster.

Ty! Never got into the analytics side of things

Re: DuckDB Isn't Just Fast

#14
post #2

Really, is this what's getting praised? I mean specifically the first point: the whole "just paste the url into the DB" - thing, + inferring the column names. That looks like the laziest and shakiest basis, and if I ever saw that in production i d be both stunned and scared

What's wrong with the URL in the query?

Re: DuckDB Isn't Just Fast

#15
post #2

Really, is this what's getting praised? I mean specifically the first point: the whole "just paste the url into the DB" - thing, + inferring the column names. That looks like the laziest and shakiest basis, and if I ever saw that in production i d be both stunned and scared

Inference for column names and datatypes seems only relevant for csv? Other formats convey that metadata, as e.g. parquet...

csv metadata inference in duckdb is amazing. There is some research in this domain and duckdb does a great job there, but yes there might be some really strange csv files, which require manual intervention.

Re: DuckDB Isn't Just Fast

#16

Earlier quoted context omitted.

For those not aware: analytical tasks involve a lot of groupings, aggregations, running sums/averages, sorting, ranking etc. Columnar databases like duckdb are more focused on those tasks so you can do these tasks much faster.

Ty! Never got into the analytics side of things

Have a look at this section of the AWS Redshift documentation (also a columnar database) to understand the advantages of these types of systems: https://docs.aws.amazon.com/redshift/latest/dg/c_columnar_st...

Or the advantage of columnar file formats, like ORC or Parquet, for analytical queries. Normally you are only interested in a few columns.

Re: DuckDB Isn't Just Fast

#17
post #4

I know I'm repeating my self (it must be my third comment on HN about this topic), but this does not match my experience at all. DuckDB will error-out with an out-of-memory exception in very simple DISTINCT ON / GROUP BY queries. Even with a temporary file, an on-disk database and not keeping the initial order. On any version of DuckDB.

In my experience, recent versions work well for out-of-core computation (I use it frequently). What is the size of the Parquet file that you are using? - I can't find the details in you previous comments.

Re: DuckDB Isn't Just Fast

#18
post #4

I know I'm repeating my self (it must be my third comment on HN about this topic), but this does not match my experience at all. DuckDB will error-out with an out-of-memory exception in very simple DISTINCT ON / GROUP BY queries. Even with a temporary file, an on-disk database and not keeping the initial order. On any version of DuckDB.

I've had similar times with DuckDB, it feels nicer to use on the surface but in terms of perf and actual function I've had a better experience with clickhouse-local.

Re: DuckDB Isn't Just Fast

#20

DuckDB has great ergonomics for moving data between different databases and making copies for local analysis. The one thing that differed in my experience with it from the author’s is how much of the Postgres sql dialect (and extensions) it supports. Attempting to run my Postgres analytics sql code in duckdb errors out on most json operations - to be fair, the DuckDB json functions have cleaner names than jsonb_path_…

You may know this already but the postgres extension[1] may help:

If I understand it correctly, when you use it it:

- Pulls the minimal data required (inferred from the query) from postgres into duckdb

- Executes your query using duckdb execution engine

BUT, if your postgres function is not supported by DuckDB I think you can use the `postgres_execute` [2] to execute the function within postgres itself

I'm not sure whether you can e.g do a CTE pipeline that starts with postgres_execute, and then executes Duckdb sql in later stages of the pipeline

[1] https://duckdb.org/docs/extensions/postgres.html#running-sql... [2]https://duckdb.org/docs/extensions/postgres.html#the-postgre...

Post reply on HN