We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
AS MATERIALIZED
1 parent 50600d4 commit be4dd4fCopy full SHA for be4dd4f
database/src/pool/postgres.rs
@@ -1970,11 +1970,15 @@ where
1970
// We take the oldest job from the job_queue matching the benchmark_set,
1971
// target and status of 'queued' or 'in_progress'
1972
// If a job was dequeued, we increment its retry (dequeue) count
1973
+
1974
let row_opt = self
1975
.conn()
1976
.query_opt(
1977
"
- WITH picked AS (
1978
+ -- We use the AS MATERIALIZED clause to ensure that Postgres will run each CTE only once,
1979
+ -- and not do any optimizer magic that could run the CTE query multiple times.
1980
+ -- See https://stackoverflow.com/a/73967537/1107768
1981
+ WITH picked AS MATERIALIZED (
1982
SELECT
1983
id
1984
FROM
0 commit comments