-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimization of trivial INSERT SELECT significantly slows down some queries #36792
Comments
The difference is in number of threads: https://gist.github.com/tavplubix/b2c9a7f101ccc7dbe21a844348d7757f ClickHouse/src/Interpreters/InterpreterInsertQuery.cpp Lines 344 to 354 in b24ca8d
But default value of max_insert_threads is 0, which means "choose automatically".
However, it's not clear why the first query with CTE is "trivial" and the second one is not... |
It's because
cc: @ucasfl |
Simpler example:
|
Hi, why this be reverted? @KochetovNicolai |
It was not reverted, it was never merged to master |
The creation of table becomes too slow when I use CTEs within the query.
ClickHouse server version 22.4.3
How to reproduce
Trying to create a table based on the result of a query, I take very bad performance when I use a CTE:
Although the two scenarios do exactly the same thing, with the difference that in the first scenario we use an intermediate CTE, there is a huge difference in the execution time.
The issue becomes even stranger if you execute the following queries and see that the execution time is the same, that in generally makes sense.
Obviously, there is a performance issue when someone wants to
CREATE TABLE AS
and uses CTEs in the query.Does anyone know why clickhouse behaves in that strange way?
The text was updated successfully, but these errors were encountered: