ActiveRecord::StatementInvalid: PG::QueryCanceled: ERROR: canceling statement due to statement timeout
https://sentry.gitlap.com/gitlab/gitlabcom/issues/217006/
PG::QueryCanceled: ERROR: canceling statement due to statement timeout
peek/views/pg.rb:17:in `async_exec'
super(*args)
peek/views/pg.rb:17:in `async_exec'
super(*args)
active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
@connection.async_exec(sql)
active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
:binds => binds) { yield }
active_support/notifications/instrumenter.rb:20:in `instrument'
yield payload
...
(45 additional frame(s) were not displayed)
ActiveRecord::StatementInvalid: PG::QueryCanceled: ERROR: canceling statement due to statement timeout
: WITH freqs AS (
SELECT stage_id, stage_idx, COUNT(*) AS freq FROM ci_builds
WHERE stage_id BETWEEN 8905427 AND 12111336
AND stage_idx IS NOT NULL
GROUP BY stage_id, stage_idx
), indexes AS (
SELECT DISTINCT stage_id, last_value(stage_idx)
OVER (PARTITION BY stage_id ORDER BY freq ASC) AS index
FROM freqs
)
UPDATE ci_stages SET position = indexes.index
FROM indexes WHERE indexes.stage_id = ci_stages.id
AND ci_stages.position IS NULL;
PG::QueryCanceled: ERROR: canceling statement due to statement timeout
: WITH freqs AS (
SELECT stage_id, stage_idx, COUNT(*) AS freq FROM ci_builds
WHERE stage_id BETWEEN 8905427 AND 12111336
AND stage_idx IS NOT NULL
GROUP BY stage_id, stage_idx
), indexes AS (
SELECT DISTINCT stage_id, last_value(stage_idx)
OVER (PARTITION BY stage_id ORDER BY freq ASC) AS index
FROM freqs
)
UPDATE ci_stages SET position = indexes.index
FROM indexes WHERE indexes.stage_id = ci_stages.id
AND ci_stages.position IS NULL;