Is there a way automatically add an explicit limit clause to all queries?

Hi,

I know that it's possible to set the default number of rows that datagrip fetches (normally 500). However I'm wondering if there is a way to make datagrip run queries with an EXPLICIT limit set in the query, if the user hasn't specified one.

The reason is that the default behaviour seems to only limit the number of rows datagrip fetches from the resultset, but doesn't have any effect on how the server runs the query. When connecting with AWS Athena, Athena will run the full query at the server side and store the results in s3, regardless of how many rows you actually fetch from the result, which can be very costly and slow, compared with when you explicitly set a limit in the sql itself.

Cheers

Tom

3

@Tom Walter,

In general IDE will use limit in query if it is supported when you want to see contents of a table. By default the value is 500.

You can change it in:
or

 

> The reason is that the default behaviour seems to only limit the number of rows datagrip fetches from the resultset, but doesn't have any effect on how the server runs the query. 

This behavior depends on JDBC driver implementation. If you want to open a table with explicit limit you can run query in console and work with result set. If it doesn't help you need to contact Amazon for more information.

As I can see in Athena documentation it accepts LIMIT in SELECT statement in queries https://docs.aws.amazon.com/athena/latest/ug/select.html

 

-1

Hi Tom,

I have the same issue, not just that, every time I move to the next page, in Athenas' history appears a query for every page (without a explicit LIMIT clause). If one could force it would be much better choice and probably cheaper.

Specially in nested queries when the amount of registers could be much larger than the final result.

 

0

请先登录再写评论。