IDLE_SESSION_TIMEOUT
The
IDLE_SESSION_TIMEOUT
query option sets the time in seconds after which an idle session is cancelled. A session is idle when no activity is occurring for any of the queries in that session, and the session has not started any new queries. Once a session is expired, you cannot issue any new query requests to it. The session remains open, but the only operation you can perform is to close it.
就是会话允许的空闲时间有多少,我们这边设置的0永不超时,也就是说只要你打开了会话窗口即使你一两个小时不操作,他也不会关闭,感觉有好有坏吧。
EXEC_TIME_LIMIT_S
The
EXEC_TIME_LIMIT_S
query option sets a time limit on query execution. If a query is still executing when time limit expires, it is automatically canceled. The option is intended to prevent runaway queries that execute for much longer than intended.For example, an Impala administrator could set a default value of
EXEC_TIME_LIMIT_S=3600
for a resource pool to automatically kill queries that execute for longer than one hour (see Admission Control and Query Queuing for information about default query options). Then, if a user accidentally runs a large query that executes for more than one hour, it will be automatically killed after the time limit expires to free up resources. Users can override the default value per query or per session if they do not want the defaultEXEC_TIME_LIMIT_S
value to apply to a specific query or a session.Note:
The time limit only starts once the query is executing. Time spent planning the query, scheduling the query, or in admission control is not counted towards the execution time limit.
SELECT
statements are eligible for automatic cancellation until the client has fetched all result rows. DML queries are eligible for automatic cancellation until the DML statement has finished.
同上 主要是说有的sql查询的特别慢,超过了一定时间怎么办。
为什么要设置这个参数,因为比如有个sql查了20张表互相join各种order by只是举例。
因为有的查询真的是非常慢,比如impala总共200G内存,他这个查询就占了180G,你要是跑完了还好说,跑不完一直占用内存,那么其他的sql怎么执行呢?
所以需要这个参数。当然出现这种问题 只针对某个sql的会话使用该参数。
SET EXEC_TIME_LIMIT_S=3600;
select * from table; --耗时长的sql 和上面一起使用。
尽量不要全局使用!!!!
QUERY_TIMEOUT_S
Sets the idle query timeout value for the session, in seconds. Queries that sit idle for longer than the timeout value are automatically cancelled. If the system administrator specified the
--idle_query_timeout
startup option,QUERY_TIMEOUT_S
must be smaller than or equal to the--idle_query_timeout
value.Note:
The timeout clock for queries and sessions only starts ticking when the query or session is idle.
For queries, this means the query has results ready but is waiting for a client to fetch the data. A query can run for an arbitrary time without triggering a timeout, because the query is computing results rather than sitting idle waiting for the results to be fetched. The timeout period is intended to prevent unclosed queries from consuming resources and taking up slots in the admission count of running queries, potentially preventing other queries from starting.
For sessions, this means that no query has been submitted for some period of time.
query_timeout_S必须小于或等于idle_query_timeout
值。
这个看着和EXEC_TIME_LIMIT_S 有点像 其实不是的。
里面有段话是 查询和会话的超时只有在查询或会话空闲时才会开始计时。
对于query_timeout_S,这意味着查询已经准备好了结果,但正在等待客户端获取数据。查询可以在不触发超时的情况下运行任意时间,因为查询是在计算结果,而不是闲置等待获取结果。
这里说的比较模糊,大意就是你看着我啥也没看 其实我在等待数据返回结果。
那你返回结果了之后不应该是idle_query_timeout
吗? 为啥要小于这个值呢?看下面一句话
query_timeout_S超时设置是防止未关闭的查询消耗资源并占用正在运行的查询的准入计数中的插槽,从而可能阻止其他查询启动。
有点难理解。。。
直接实战来波。
我有个sql select * from t --耗时 2.2s左右
SET EXEC_TIME_LIMIT_S=1
查询报错 expired due to execution time limit of 1s000ms
SET EXEC_TIME_LIMIT_S=2
查询成功 耗时2.4s
SET EXEC_TIME_LIMIT_S=0
set QUERY_TIMEOUT_S=1查询成功 耗时2.1s
这里确实不太理解这个QUERY_TIMEOUT_S