AST too big

1,232 views
Skip to first unread message

rasmus

unread,
Jan 16, 2017, 10:19:33 AM1/16/17
to ClickHouse
When executing query like(query length is rather big):
SELECT value1, value2, value3 FROM test_table FINAL WHERE (value_in1, value_in2) IN ((1, 2), (3, 4)..... and so on.

Getting such error:
Caused by: ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: localhost, port: 8123; Code: 168, e.displayText() = DB::Exception: AST is too big. Maximum: 50000,

But I getting such error only if length query is very large, for small queries everything is ok.

How to deal with it?
Thanks.

Pavel Artemkin

unread,
Jan 16, 2017, 1:39:59 PM1/16/17
to ClickHouse
Why do you need such a big query?
Is it possible to store ((1, 2), (3, 4), ...) into some table and after that use IN (SELECT ... FROM tmp) ?


понедельник, 16 января 2017 г., 20:19:33 UTC+5 пользователь rasmus написал:

rasmus

unread,
Jan 17, 2017, 5:18:29 AM1/17/17
to ClickHouse
These values ((1,2),(3,4)...) are creates dynamically, i.e. theses values are collect together in memory and sometimes we do queries with IN .

понедельник, 16 января 2017 г., 20:39:59 UTC+2 пользователь Pavel Artemkin написал:

Pavel Artemkin

unread,
Jan 17, 2017, 5:27:11 AM1/17/17
to ClickHouse
OK, but could you do the following?
1. Collect some values in memory.
2. Create a temporary table and insert all values from above.
3. Execute query with IN (SELECT ...).
4. Drop the temporary table.


вторник, 17 января 2017 г., 15:18:29 UTC+5 пользователь rasmus написал:

rasmus

unread,
Jan 17, 2017, 5:39:31 AM1/17/17
to ClickHouse
Yes, I can do this.
Thanks for clarification!

вторник, 17 января 2017 г., 12:27:11 UTC+2 пользователь Pavel Artemkin написал:

man...@gmail.com

unread,
Jan 17, 2017, 7:04:29 PM1/17/17
to ClickHouse
You could also raise the value of 'max_ast_elements' setting.
Reply all
Reply to author
Forward
0 new messages