question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

max_query_size URL parameter stopped working

See original GitHub issue

We use max_query_size as JDBC URL parameter to increase allowed select query size: jdbc:clickhouse://ch-host:8123/db?max_query_size=1000000

After switching from the deprecated package ru.yandex.clickhouse to the new one com.clickhouse.jdbc we discovered that this parameter is ignored and currently we have exceptions:

java.sql.BatchUpdateException: Code: 62. DB::Exception: Syntax error: failed at position 262144 ('86') (line 16, col 261384): 86. Max query size exceeded: '86'. (SYNTAX_ERROR) (version 21.12.3.32 (official build))
, server ClickHouseNode [uri=http://ch-host:8123/db, options={max_query_size=1000000,socket_timeout=30000,async=true,http_keep_alive=true}]@1448807023
	at com.clickhouse.jdbc.SqlExceptionUtils.batchUpdateError(SqlExceptionUtils.java:109)
	at com.clickhouse.jdbc.internal.SqlBasedPreparedStatement.executeAny(SqlBasedPreparedStatement.java:208)
	at com.clickhouse.jdbc.internal.SqlBasedPreparedStatement.executeQuery(SqlBasedPreparedStatement.java:235)

Position 262144 is related to the default limit of 256 KiB.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
zhicwucommented, Sep 13, 2022

but I had to remove socket_timeout option and set it in url

socket_timeout is not a server setting so you have to put it separately in connection string or properties.

Am I right that all settings from ClickHouse Settings should be in custom_settings?

Yes, maybe it should be renamed to custom_server_settings but it’s getting too long to type in :p On a side note, if you have many settings to mange, you probably should consider to use server profile instead to benefit all type of clients instead of just JDBC.

Or could you please explain when to use custom_http_params, custom_settings and ordinary properties? And are there plans to support all params in url string?

custom_http_params only works when using http protocol and it should support arbitrary parameter regardless it’s a server setting or not. The driver will simply append the parameters to server url and then send http request accordingly. custom_settings on the other hand is more generic and it’s also supported by other protocols like grpc and tcp. I think in most cases we should use custom_settings, but if you’re using http and no plan to switch to any other protocol, you may use custom_http_params as well.

1reaction
zhicwucommented, Aug 18, 2022

Hi @konstantinosss, you can add custom_http_params in connection property or url, for examples:

  • connection property
    Properties props = new Properties();
    // comma separated custom settings, you can add custom_http_headers in a similar way as well
    props.setProperty("custom_http_params", "session_check=0,max_query_size=1000");
    
  • connection url
    String url = "jdbc:clickhouse://ch-host:8123/db"
      // same as above but url encoded
      + "?custom_http_params=session_check%3D0%2Cmax_query_size%3D1000";
    

Sorry this is more of a workaround at this point because it’s limited to http protocol. I’ll add custom_settings to support more protocols.

Read more comments on GitHub >

github_iconTop Results From Across the Web

URL Query Parameters Not Working - ServiceNow Community
Solved: Trying to run a query on our instance using parameters recommended in the SN wiki. However, the results are not correct. Below...
Read more >
URL parameter query not working - WordPress.org
I'm trying to use a URL parameter to pre=populate my form, as described here: https://wordpress.org/support/topic/query-parameter-not-documented/#post- ...
Read more >
Filter a report using query string parameters in the URL
Filter a report using query string parameters in the URL - not working because of & ... This is my column name and...
Read more >
Solved: rp: Parameter in URL does not work
Solved: Dear All, I have a report with a parameter. If I change the value in the parameter area manually everything works fine...
Read more >
A Beginner's Guide to URL Parameters - Semrush
In this guide, we'll share the most common SEO issues to watch out for when working with URL parameters.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found