Skip to content

Review "db olympics" results #26661

Open

Description

@alamb

Is your feature request related to a problem or challenge?

@toschmidt of TU-Munich (an influential database research group) posted the following:

Here is the site: https://dbolympics.com/

He invited us to review the configuration of DataFusion to make sure it got a fair evaluation. We currently don't look great in the results:
Image

Describe the solution you'd like

I would like to investigate DataFusions results and make sure we understand (and document) what it would take to improve the system with this benchmark

Given the fact that we are in good (commercial) company with ClickHouse, and the pedigree of the author (the same research lab that published the various query optimizer papers, on which the systems at the top left are based) I am not overly concerned about DataFusion's actual competitiveness in real world queries. However, TUM is influential and I suspect this benchmark will show up in the research literature shortly

I suspect the benchmark skews heavily towards join ordering and systems which use the TUM -inspired algorithms will do well on, but that would be good to confirm.

Describe alternatives you've considered

I think the first thing to do is reproduce the results

Then ideally we would identity the categories were we need to do better. The benchmark site also makes some vague mention that it penalizes correctness but I haven't figured out how that is incorporated yet

Image

Additional context

Related to a similar post recently the polars folks put out that similarly show good join results (TPC-H/TPC-DS):

Willingness to contribute

None

Activity

  1. added theissue type on Oct 23, 2026
  2. alamb commented on Oct 23, 2026

    @alamb
    ContributorAuthor

    One major difference is that DataFusion reads the raw parquet files while all the other systems have to load them first:

    Image

    So you could also spin these results that DataFusion loads 100x faster than other systems. Pointed out here dbolympics/dbolympics#2 (comment)

  3. mbutrovich commented on Oct 23, 2026

    @mbutrovich
    Contributor

    Thanks for sharing this @alamb! I'll dig into the methodology and see how hard it is to reproduce the results locally and/or in the cloud https://dbolympics.com/methodology.html

  4. alamb commented on Oct 23, 2026

    @alamb
    ContributorAuthor

    At the very least I am going to try and reproduce the wrong results they report as part of larger "correctness epic" I working on organizing

  5. alamb commented on Oct 23, 2026

    @alamb
    ContributorAuthor
  6. mbutrovich commented on Oct 23, 2026

    @mbutrovich
    Contributor

    Filed #26671. I will also see if a query rewrite on dbolympics is suitable in the meantime.

  7. alamb commented on Oct 23, 2026

    @alamb
    ContributorAuthor

    Thanks @mbutrovich I have another one related to EXTRACT I am working on

    I also filed a fix for to_char

    Also related to correctness, I filed an epic to track the work

  8. mbutrovich commented on Oct 23, 2026

    @mbutrovich
    Contributor
  9. alamb commented on Oct 23, 2026

    @alamb
    ContributorAuthor

    I also filed a issue about inconsistent EPOCH truncation (which I think is related to some of the db olympics failures)

  10. mbutrovich commented on Oct 23, 2026

    @mbutrovich
    Contributor

    I also filed a issue about inconsistent EPOCH truncation (which I think is related to some of the db olympics failures)

    Nice, thank you! This is the cause of the remaining SF1 wrong results in the benchmark: q124, q127, q128, q197 and q405 all average or take a percentile of CAST(EXTRACT(EPOCH FROM (ts1 - ts2)) AS NUMERIC(18,6)). With the expression replaced by (CAST(ts1 AS BIGINT) - CAST(ts2 AS BIGINT)) / 1000000.0, all five match the reference results. Together with the year_month dialect change and #26671, DataFusion 55.0.0 at SF1 has no wrong results left (331 equal, 0 different, 78 queries that return errors).

  11. mbutrovich commented on Oct 23, 2026

    @mbutrovich
    Contributor

    #26676 is ready for review and delivers speedup on top of the #26673 correctness issue.

  12. comphead commented on Oct 23, 2026

    @comphead
    Contributor
  13. jayzhan211 commented on Oct 24, 2026

    @jayzhan211
    Contributor

    I ran all 409 queries against main with the benchmark's schema and a few rows per table, so this covers queries that fail, not wrong results or timeouts. Of the 78 queries that fail on 55.0.0, 31 work on main. Three of those 31 failed on 55.0.0 while comparing decimals at run time, which needs the real data to confirm.

    What still fails on main, plus one query that broke after 55.0.0:

    Cause Queries Tracked in
    Subquery inside an aggregate (GROUP BY key, aggregate argument or FILTER) 13 #26704
    Correlated scalar subquery with ORDER BY ... LIMIT 1, mostly "the exchange rate as of a date" 11 #26710
    Correlated subquery whose correlation is a range rather than an equality 8 #14554, #5492
    Correlated scalar subquery without an aggregate 5 #16137
    Correlated subquery that references a table two levels up (Schema error: No field named p.id) 3 #15558, #21727
    Integer or float times an interval or duration 3 #13850
    json_value 2 not built in
    Scalar subquery in a JOIN ... ON condition 1
    abs(COALESCE(...)) in a window ORDER BY fails SanityCheckPlan 1 #26430
    Decimal sum next to count(DISTINCT), broken since #24859 1 #26193, fix in #26211

    18 queries correlate on a range: the 8 in the range row, 8 of the 11 LIMIT 1 queries and two in the aggregate row. Nine of them are the same exchange-rate lookup (er.as_of <= o.closed_at ORDER BY er.as_of DESC LIMIT 1), which the ASOF join on main already computes, see #26710. The other nine need general range decorrelation.

    Queries per row
    Cause Queries
    Subquery inside an aggregate q057 q084 q085 q091 q135 q136 q156 q178 q182 q312 q315 q370 q409
    ORDER BY ... LIMIT 1 q077 q174 q176 q181 q183 q194 q365 q368 q383 q386 q388
    Range correlation q086 q113 q162 q167 q273 q274 q289 q403
    Scalar subquery without an aggregate q098 q179 q263 q363 q367
    Two levels up q353 q358 q393
    Interval or duration arithmetic q250 q341 q379
    json_value q175 q399
    Scalar subquery in JOIN ... ON q064
    abs(COALESCE(...)) window q121
    Decimal sum q158

    Anyone is welcome to pick up a row; feel free to ping me for the exact errors of each query.

  14. alamb commented on Oct 24, 2026

    @alamb
    ContributorAuthor
    json_value 2 not built in

    We could perhaps propose updating the runner with datafusion-functions-json

  15. alamb commented on Oct 24, 2026

    @alamb
    ContributorAuthor

    Thank you for this analysis @jayzhan211

    BTW I don't think we necessarily should fix all the subquery errors as point fixes as the decorrelation code is already complicated enough. It may be time we have to focus on a more general framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions