Redash Redshift Connection - Transaction Spam (?)

Hey! We got a Redshift connection with Redash, we have a few connections set, however, one of the connections seems to open many transactions and we cannot really tell why this is happening. The transaction always executes the following query (part of this but you get the gist):

        WITH tables AS (
            SELECT DISTINCT table_name,
                            ordinal_position AS pos
            FROM svv_columns
            WHERE table_schema NOT IN ('pg_internal','pg_catalog','information_schema')
        SELECT table_name, table_schema, column_name
        FROM tables
            HAS_SCHEMA_PRIVILEGE(table_schema, 'USAGE') AND
                table_schema IN (SELECT schemaname FROM SVV_EXTERNAL_SCHEMAS) OR

Is this normal behaviour? Why is this happening with one connection out of the 5 that we have?

Would appreciate help,
Thanks! :slight_smile:

That’s the schema refresh job for postgres data sources. How many transactions are you talking about? Over what period of time? How did you install Redash? Are you using kubernetes? Do you have multiple Redash instances running?

Hey @jesse

But why is the schema refresh job being triggered over and over again for this specific connection?
I’m talking about over 80 transactions as such:

We host redash on Kubernetes, setup:

Well that’s the question isn’t it :wink:

K8S is a whole different animal. We don’t support it officially and I don’t know your answer since we haven’t seen this question before. Here’s a good place for you to start with your debugging, however:

  1. Redash periodically refreshes database schemas in the background (every few hours). So some number of automatic and repeated transactions are to be expected.
  2. A schema refresh can be triggered manually either within the application (by clicking the refresh button) or using the API to hit /api/data_sources/<ds_id>/schema?refresh

So something is causing these tasks to fire at an unusually high rate. Given that K8S is an untamed beast that nobody really understands, my bet is you have some confusion in your setup that causes the same refresh job to be duplicated with multiple workers running one job at the same time. This doesn’t happen in non-K8S setups, but we’ve seen a few issues along this thread from others.

It’s possible you have multiple Redis instances. Or multiple schedulers.

Alternatively, if you use the API heavily there’s a possibility that these transactions are manually kicked-off with an HTTP request. I think this is unlikely. You can rule it out by checking your server logs for requests to /schema?refresh.