Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
579 views
in Technique[技术] by (71.8m points)

locking - Redshift - enforcing autocommit

Is there a Redshift cluster option to enforce autocommit=True for all connections? I.e. not to allow to establish a connection / run a query unless the setting was set.

We're having a lot of locking issues because some SQL tools have autocommit=False by default.

question from:https://stackoverflow.com/questions/65851945/redshift-enforcing-autocommit

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I know of no such option and you likely wouldn't want one. The down side of autocommit is that all statements are their own transaction and must be processed through the commit queue. The commit queue is a singular resource in the cluster and can be overloaded if you have too many commits. ETL flows generally require performing multiple statements within a transaction to maintain database consistency.

With that said I feel your pain. Large poorly trained database users can cause all sorts of locking issues. Standardizing workbenches and their configuration can help but there will always be a few that have to use their own. Creating daemons that look for idle connections and close them also can help. Education is also key. The most important action is to rationalize your ETL flows to not be blocked by read locks. Some statements, like drop, will be blocked as long as a read lock is on the table but truncate can proceed with such locks. So drop-and-swap is not a good choice for tables that are used for queries by general users.

Sometimes I also wish there was a way to put certain users into autocommit along with read-only.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...