Start a new topic

Automatic LIMIT clause

I'm currently evaluating ClickHouse, a new open source columnar RDBMS for "big data" and other analytics / data warehouse applications. One of the first thing I installed was of course its JDBC Driver to use it with DbVis.

But the DB and its JDBC driver really take throughput seriously: without a LIMIT clause, a SELECT will take forever, because the engine is preparing to stream GBs of data at you.

Unfortunately I could not find a way to configure DbVis so that it passes the row limit (Max Rows in the status bar) to the engine, in the form of a LIMIT clause at the end of the query.

I'm currently working around the issue by leaving Max Rows to -1 and writing LIMIT by hand in the Filter bar, but it's not as convenient.

Does DbVis provide an option to translate Max Rows into a LIMIT clause? If not, can you add it as a feature request? I see somebody else inquired about it 4 years ago for another DB, but I can't tell if anything has been done about it.

Hi Tobia,

As per the JDBC specification, the Statement#setMaxRows() method is the way to limit the number of rows a statement should return. It is up to the driver implementation to translate this into something the database supports, e.g. adding a LIMIT clause. I therefore urge you to ask the JDBC driver vendor to handle this inĀ Statement#setMaxRows().

That said, we know of a few drivers with this problem and have an open ticket to see if we can work-around this at least for the special case of the query used by the Data tab. I'll add your vote.

Best Regards,


1 person likes this
You are right of course. I've opened an issue on their GitHub repo (and will probably contribute a patch if nobody else solves it.)


Login or Signup to post a comment