Snowflake JDBC repeating pattern of auto commit statements

Viewed 52

enter image description here

I've pulled out logs from snowflake directly to see what queries are being fired from the app and noticed that this particular statement is repeatedly being called at fixed interval.

I wanted to understand why the above statement is executed repeatedly when we are not firing the same via our application. Is this the default behaviour from Snowflake JDBC driver?

Here is the JDBC url:

jdbc:snowflake://${sf.customer.datasource.w2.account}.snowflakecomputing.com/?insecureMode=true&\
  db=${sf.customer.datasource.w2.database}&warehouse=${sf.customer.datasource.w2.warehouse}&CLIENT_SESSION_KEEP_ALIVE=false&\
  schema=${sf.customer.datasource.w2.schema}&role=${sf.customer.datasource.w2.role}&TIMEZONE=${sf.customer.datasource.w2.timezone:UTC}&\
  CLIENT_RESULT_COLUMN_CASE_INSENSITIVE=true&CLIENT_TIMESTAMP_TYPE_MAPPING=TIMESTAMP_NTZ
1 Answers

This is how it's working from JDBC side:

  1. JDBC gets the AUTOCOMMIT value from Snowflake server side
  2. It caches the value of AUTOCOMMIT
  3. When a new call is done if the cached value is the same value as the specified value, skip running alter session, otherwise execute alter session.

This was implemented a long time ago via SNOW-115735 to actually reduce the number of alter session set autocommit.

The AUTOCOMMIT in Snowflake is by default set to True so I have a feeling it's set to False in your Spring configuration which would force JDBC all the time to set it to False.

Related