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,
table_schema,
column_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
WHERE
HAS_SCHEMA_PRIVILEGE(table_schema, 'USAGE') AND
(
table_schema IN (SELECT schemaname FROM SVV_EXTERNAL_SCHEMAS) OR
HAS_TABLE_PRIV
Is this normal behaviour? Why is this happening with one connection out of the 5 that we have?
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?
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:
Redash periodically refreshes database schemas in the background (every few hours). So some number of automatic and repeated transactions are to be expected.
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.