Timeout on a SQL query issues another SQL query to generate EXPLAIN

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Timeout on a SQL query issues another SQL query to generate EXPLAIN

michael.griggs
In IgniteH2Indexing.java#executeSqlQueryWithTimer we automatically issue a second query to "EXPLAIN" why a query has timed out. I think we should make optional the automatic issuance of a second "EXPLAIN" query. When a query times out it could very well be due to high load on the system, and issuing a second query for every timed-out one will only increase system load, leading to more timeouts, and so on...
            ResultSet rs = executeSqlQuery(conn, stmt, timeoutMillis, cancel);

            long time = U.currentTimeMillis() - start;

            long longQryExecTimeout = schemas.get(schema(space)).ccfg.getLongQueryWarningTimeout();

            if (time > longQryExecTimeout) {
                String msg = "Query execution is too long (" + time + " ms): " + sql;

                ResultSet plan = executeSqlQuery(conn, preparedStatementWithParams(conn, "EXPLAIN " + sql,
                    params, false), 0, null);
What do others think?
Reply | Threaded
Open this post in threaded view
|

Re: Timeout on a SQL query issues another SQL query to generate EXPLAIN

dsetrakyan
Perhaps we can cache the timed out queries, so we don't need to "explain"
them more than once.

On Wed, Mar 15, 2017 at 11:07 AM, michael.griggs <
[hidden email]> wrote:

> In IgniteH2Indexing.java#executeSqlQueryWithTimer we automatically issue a
> second query to "EXPLAIN" why a query has timed out.  I think we should
> make
> optional the automatic issuance of a second "EXPLAIN" query.  When a query
> times out it could very well be due to high load on the system, and issuing
> a second query for every timed-out one will only increase system load,
> leading to more timeouts, and so on...
>             ResultSet rs = executeSqlQuery(conn, stmt, timeoutMillis,
> cancel);            long time = U.currentTimeMillis() - start;
> long longQryExecTimeout =
> schemas.get(schema(space)).ccfg.getLongQueryWarningTimeout();
> if
> (time > longQryExecTimeout) {                String msg = "Query execution
> is too long (" + time + " ms): " + sql;                ResultSet plan =
> executeSqlQuery(conn, preparedStatementWithParams(conn, "EXPLAIN " + sql,
> params, false), 0, null);
> What do others think?
>
>
>
> --
> View this message in context: http://apache-ignite-
> developers.2346864.n4.nabble.com/Timeout-on-a-SQL-query-
> issues-another-SQL-query-to-generate-EXPLAIN-tp15475.html
> Sent from the Apache Ignite Developers mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Timeout on a SQL query issues another SQL query to generate EXPLAIN

Sergi
Explain is relatively fast operation, it is just parsing + prepare, not the
query execution. If one does not like to see these warnings, he can
increase longQueryWarningTimeout property on the configuration, so it is
already optional and I don't see any problems here.

Sergi

2017-03-15 22:26 GMT+03:00 Dmitriy Setrakyan <[hidden email]>:

> Perhaps we can cache the timed out queries, so we don't need to "explain"
> them more than once.
>
> On Wed, Mar 15, 2017 at 11:07 AM, michael.griggs <
> [hidden email]> wrote:
>
> > In IgniteH2Indexing.java#executeSqlQueryWithTimer we automatically
> issue a
> > second query to "EXPLAIN" why a query has timed out.  I think we should
> > make
> > optional the automatic issuance of a second "EXPLAIN" query.  When a
> query
> > times out it could very well be due to high load on the system, and
> issuing
> > a second query for every timed-out one will only increase system load,
> > leading to more timeouts, and so on...
> >             ResultSet rs = executeSqlQuery(conn, stmt, timeoutMillis,
> > cancel);            long time = U.currentTimeMillis() - start;
> > long longQryExecTimeout =
> > schemas.get(schema(space)).ccfg.getLongQueryWarningTimeout();
> > if
> > (time > longQryExecTimeout) {                String msg = "Query
> execution
> > is too long (" + time + " ms): " + sql;                ResultSet plan =
> > executeSqlQuery(conn, preparedStatementWithParams(conn, "EXPLAIN " +
> sql,
> > params, false), 0, null);
> > What do others think?
> >
> >
> >
> > --
> > View this message in context: http://apache-ignite-
> > developers.2346864.n4.nabble.com/Timeout-on-a-SQL-query-
> > issues-another-SQL-query-to-generate-EXPLAIN-tp15475.html
> > Sent from the Apache Ignite Developers mailing list archive at
> Nabble.com.
>