mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
* Deduplicate stl_querytext rows, fixes #8867 * Update queries.py Filter down result-set by joining with queries * Reduce line character length
This commit is contained in:
parent
4a5676d617
commit
d8674bd7f8
@ -31,12 +31,19 @@ REDSHIFT_SQL_STATEMENT = textwrap.dedent(
|
||||
AND starttime < '{end_time}'
|
||||
LIMIT {result_limit}
|
||||
),
|
||||
deduped_querytext AS (
|
||||
-- Sometimes rows are duplicated, causing LISTAGG to fail in the full_queries CTE.
|
||||
SELECT DISTINCT qt.*
|
||||
FROM pg_catalog.stl_querytext AS qt
|
||||
INNER JOIN queries AS q
|
||||
ON qt.query = q.query
|
||||
),
|
||||
full_queries AS (
|
||||
SELECT
|
||||
query,
|
||||
LISTAGG(CASE WHEN LEN(RTRIM(text)) = 0 THEN text ELSE RTRIM(text) END, '')
|
||||
WITHIN GROUP (ORDER BY sequence) AS query_text
|
||||
FROM pg_catalog.stl_querytext
|
||||
FROM deduped_querytext
|
||||
WHERE sequence < 327 -- each chunk contains up to 200, RS has a maximum str length of 65535.
|
||||
GROUP BY query
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user