Query.timeout.sec Does the setting work normally?

“principal=admin, cache=false, jit=false, time=5924508, msg=[-1] timeout, query aborted, errno=-1, ​​pos=0]” The error occurs, but the time specified as time is a long time. It appears to have worked. My current setting is 60 seconds.

Hi @allen ,

Please could you add a bit more context? The time= number comes from a nanosecond clock.

I tried to compile the trade information collected in seconds in September. However, since there was too much data collected, I had to repeat the process for each symbol.

Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: timeout, query aborted

Position: 1

The error may exist in file [/opt/apache-tomcat-9.0.65/webapps/ROOT/WEB-INF/classes/mapper/qdb/TrafficRepository.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL:

INSERT INTO trade_month
SELECT  timestamp_floor('m', ts) ts , symbol, sum(side) side, sum(price) price, sum(amount) amount
FROM trade
WHERE  ts >= '2024-09-01T00:00:00.000000Z'
AND ts < '2024-10-01T00:00:00.000000Z'
AND symbol = :vSymbol
;

Cause: org.postgresql.util.PSQLException: ERROR: timeout, query aborted

Position: 1
; uncategorized SQLException; SQL state [00000]; error code [0]; ERROR: timeout, query aborted
Position: 1; nested exception is org.postgresql.util.PSQLException: ERROR: timeout, query aborted
Position: 1
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy191.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
at com.sun.proxy.$Proxy206.insertTrafficDstHourly(Unknown Source)
at kr.co.noas.ms.service.SessionCategoryService.lambda$addTasksByOrgId$36(SessionCategoryService.java:836)
at kr.co.noas.ms.service.SessionCategoryService.lambda$runTasks$0(SessionCategoryService.java:99)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at kr.co.noas.ms.service.SessionCategoryService.runTasks(SessionCategoryService.java:92)
at kr.co.noas.ms.service.SessionCategoryService.insertHourlyStatisticsByMybatis(SessionCategoryService.java:812)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:95)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.postgresql.util.PSQLException: ERROR: timeout, query aborted
Position: 1
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2565)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2297)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:322)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:153)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at jdk.internal.reflect.GeneratedMethodAccessor330.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at kr.co.noas.ms.configuration.TimezoneInterceptor.intercept(TimezoneInterceptor.java:54)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy238.update(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at jdk.internal.reflect.GeneratedMethodAccessor329.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
… 24 common frames omitted

I’m not sure what the question is! But as you say, if you are getting timeouts, you can either up the limit, or you can select less data and paginate.