-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Significant performance degradation of ASOF join between 22.12 and 23.01 #47201
Description
There is a huge performance degradation of ASOF join between versions 22.12 and 23.01
Asof join in 23.01 is many times slower compared to 22.12. In 22.12 following query runs with steady performance of ~30M rows/sec. In 23.01 it runs times slower, less than 5M/sec, actually the longer query runs the slower it becomes. It starts with same numbers, but over the time gets slower and slower.
query:
SELECT
t1.trade_price,
t1.exchange_ts,
t1.security,
t2.bid_price,
t2.ask_price,
t2.bid_size,
t2.ask_size
FROM
(
SELECT *
FROM data
WHERE message_type = 'trade'
) AS t1
ASOF LEFT JOIN
(
SELECT *
FROM data
WHERE message_type = 'quote'
) AS t2 ON (t1.security = t2.security) AND (t1.exchange_ts >= t2.exchange_ts)
SETTINGS max_threads = 32
This is unrelated to #46453. I did revert #35525 manually on top of master branch and build from source, still the same performance problem.
I’m not sure which commit bring this problem, but a build from this PR 1c2dc05 works just fine, stable good performance. So it’s something between this PR and 23.01 release. Version 23.02 also has this problem.
Data schema:
┌─name────────────┬─type─────────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ dtype │ LowCardinality(Nullable(String)) │ │ │ │ │ │
│ ip_address │ Nullable(String) │ │ │ │ │ │
│ exchange_ts │ Nullable(Int64) │ │ │ │ │ │
│ seqnum │ Nullable(UInt32) │ │ │ │ │ │
│ market │ Nullable(String) │ │ │ │ │ │
│ product │ LowCardinality(Nullable(String)) │ │ │ │ │ │
│ message_type │ LowCardinality(Nullable(String)) │ │ │ │ │ │
│ trade_price │ Nullable(Float64) │ │ │ │ │ │
│ trade_size │ Nullable(UInt32) │ │ │ │ │ │
│ trade_condition │ Nullable(String) │ │ │ │ │ │
│ bid_price │ Nullable(Float64) │ │ │ │ │ │
│ bid_size │ Nullable(UInt32) │ │ │ │ │ │
│ bid_condition │ Nullable(String) │ │ │ │ │ │
│ ask_price │ Nullable(Float64) │ │ │ │ │ │
│ ask_size │ Nullable(UInt32) │ │ │ │ │ │
│ ask_condition │ Nullable(String) │ │ │ │ │ │
│ security │ LowCardinality(String) │ │ │ │ │ │
└─────────────────┴──────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
Could I somehow assist in fixing this?
All settings are default.