Presto临时设置session超时时间

耀灵1年前技术文章789

全局默认超时时间为200s:

1.png

测试语句:

select 
  "t7"."__fcol_16" "__fcol_22", 
  date_trunc('month', "t7"."__fcol_21") "__fcol_24", 
  sum("t7"."__fcol_19") "__fcol_25", 
  sum("t7"."__fcol_18") "__fcol_26"
from (select 
  "t6"."__fcol_12" "__fcol_16", 
  "t6"."__fcol_13" "__fcol_17", 
  "t6"."__fcol_14" "__fcol_18", 
  "t6"."__fcol_15" "__fcol_19", 
  date_parse("t6"."__fcol_8", '%Y%m') "__fcol_21"
from (select 
  "t5"."__fcol_3" "__fcol_8", 
  "t5"."__fcol_4" "__fcol_9", 
  "t5"."__fcol_5" "__fcol_10", 
  "t5"."__fcol_6" "__fcol_11", 
  "t5"."__fcol_7" "__fcol_12", 
  "t5"."__fcol_0" "__fcol_13", 
  sum("t5"."__fcol_2") "__fcol_14", 
  count("t5"."__fcol_3") "__fcol_15"
from (select 
  "T_77486F_0"."itemname" "__fcol_0", 
  cast(cast("T_77486F_0"."fillname" as varchar) as double) "__fcol_2", 
  "T_77486F_0"."ispc_dt" "__fcol_3", 
  "T_77486F_0"."sal_head" "__fcol_4", 
  "T_77486F_0"."sal_area" "__fcol_5", 
  "T_77486F_0"."admn_rgn" "__fcol_6", 
  "T_77486F_0"."clnt_tp" "__fcol_7"
from "dm"."fact_ispc_item_cus_imp_kpi" "T_77486F_0"
where (
  "T_77486F_0"."templatename" in (
    '2021年明细表导入', '2020年明细表导入'
  )
  and "T_77486F_0"."itemname" in (
    '蒙牛堆箱陈列数量', '伊利堆箱陈列数量', '蒙牛排面总数', '伊利排面总数', '蒙牛SKU总数', '伊利SKU总数', '得分', '蒙牛堆头及端架总数', 
    '伊利堆头及端架总数'
  )
)) "t5"
group by 
  1, 
  2, 
  3, 
  4, 
  5, 
  6
) "t6") "t7"
where (
  exists (
    select 1
    from (select 
  "t3"."__fcol_13" "__fcol_16", 
  "t3"."__fcol_14" "__fcol_17", 
  "t3"."__fcol_15" "__fcol_18"
from (select 
  "t2"."__fcol_10" "__fcol_13", 
  "t2"."__fcol_12" "__fcol_14", 
  rank() over (partition by "t2"."__fcol_10" order by "t2"."__fcol_12" desc) "__fcol_15"
from (select 
  "t1"."__fcol_6" "__fcol_10", 
  date_trunc('month', "t1"."__fcol_9") "__fcol_12"
from (select 
  "t0"."__fcol_4" "__fcol_6", 
  "t0"."__fcol_5" "__fcol_7", 
  date_parse("t0"."__fcol_0", '%Y%m') "__fcol_9"
from (select 
  "T_77486F"."ispc_dt" "__fcol_0", 
  "T_77486F"."sal_head" "__fcol_1", 
  "T_77486F"."sal_area" "__fcol_2", 
  "T_77486F"."admn_rgn" "__fcol_3", 
  "T_77486F"."clnt_tp" "__fcol_4", 
  "T_77486F"."itemname" "__fcol_5"
from "dm"."fact_ispc_item_cus_imp_kpi" "T_77486F"
where (
  "T_77486F"."templatename" in (
    '2021年明细表导入', '2020年明细表导入'
  )
  and "T_77486F"."itemname" in (
    '蒙牛堆箱陈列数量', '伊利堆箱陈列数量', '蒙牛排面总数', '伊利排面总数', '蒙牛SKU总数', '伊利SKU总数', '得分', '蒙牛堆头及端架总数', 
    '伊利堆头及端架总数'
  )
)
group by 
  1, 
  2, 
  3, 
  4, 
  5, 
  6
) "t0") "t1"
where "t1"."__fcol_7" in ('得分')
group by 
  1, 
  2
) "t2") "t3"
where "t3"."__fcol_15" <= 13) "t4"
    where (
      coalesce("t7"."__fcol_16", '0') = coalesce("t4"."__fcol_16", '0')
      and coalesce("t7"."__fcol_16", '1') = coalesce("t4"."__fcol_16", '1')
      and coalesce(date_trunc('month', "t7"."__fcol_21"), timestamp '2000-01-01 00:00:00.0') = coalesce(cast("t4"."__fcol_17" as timestamp), timestamp '2000-01-01 00:00:00.0')
      and coalesce(date_trunc('month', "t7"."__fcol_21"), timestamp '2001-01-01 00:00:00.0') = coalesce(cast("t4"."__fcol_17" as timestamp), timestamp '2001-01-01 00:00:00.0')
    )
  )
  and "t7"."__fcol_17" in ('得分')
)
group by 
  1, 
  2

测试时间为:200.4s

测试结果:

2.png


临时修改超时时间:

将临时修改语句添加到sql中:

3.png

5.png

测试时间为:272.4s

测试结果:

任务运行时间超过全局配置的200s,任务正常运行成功,临时设置session超时生效

4.png


相关文章

MySQL 8.0 新特性:innodb_dedicated_server

MySQL 8.0 新特性:innodb_dedicated_server

一、前言Innodb Dedicated Server 是 8.0 版本推出的一个参数,开启之后可以根据服务器的配置自适应 innodb 引擎中的一些重要影响性能的参数,默认是关闭的。二、参数测试使用...

TCP短连接和长连接

TCP短连接和长连接

     当网络通信时采用TCP协议时,在真正的读写操作之前,server与client之间必须建立一个连接,当读写操作完成后,双方不再需要这个连接时它们可以释放这个连接,连接的建立是需要三次握手的,...

Centos系统支持TLS 1.3

Centos系统支持TLS 1.3

一、背景1、生产的 CentOS 7 服务器需要启用 TLS 1.32、Openssl介绍OpenSSL 是用于传输层安全性 (TLS) 和安全套接字层 (SSL) 协议的强大、商业级且功能齐全的工具...

K8s Pod无法访问SLB地址

K8s Pod无法访问SLB地址

一、问题现象客户反馈172.16.11.220 telnet 47.99.87.129 80 不通,另一台172.16.11.219可以通。二、排查思路172.16.11.220,172.16.11....

Kafka日志管理

Kafka在运行时会生成大量的日志记录信息,包含了运行状态、错误信息、性能指标等。这些日志文件会占用很大的磁盘空间,过多的日志文件也会影响Kafka的性能,因此需要采取一些日志管理措施来清理无用的日志...

trino容器设置nodeselector(七)

trino容器设置nodeselector(七)

查看node labelkubectl get nodes --show-labels2、在容器中设置nodeselector属性  nodeSelector:     dps: "1"查看k8s...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。