Redshift view deadlocks?

Hi everyone, I am running into an issue with Redshift and would appreciate any suggestions.

I am creating some views on redshift using dbt. One of the in particular controls the row level access per user, so all models are ultimately joined with it. But it still is just a view definition, there are no tables in the mix.

Every single time dbt tries to update this view, if there are any queries at that time that involve that view (which is often, since this is a client facing database), it deadlocks.

By that I mean - dbt is not able to re-create the view, no one is able to query it, and this situations persists until dbt’s process is manually killed.

It seems to me that even if the view is under use, as long as there are a few seconds of downtime (which there are), then dbt should do its job and no deadlock should occur.

What I’ve tried so far:

  • decreasing number of threads to 1
  • running during a time when there is no more DB activity (this works without a problem)

Any ideas? It’s driving me crazy!


I am also experiencing this issue in Redshift. It is occurring for a view on a pretty simple and small table and the error occurrences include early morning schedules when there should be no activity on that table.

It is intermittent though. Not all scheduled runs have the issue.

I would love others thoughts on this.

@hags setting the late binding property for the views appears to have helped, but I don’t really understand why

Here’s an explanation of what late-binding views are, and why they are helpful: