perf: 23% faster job queue system on postgres/sqlite (#13187)

Previously, a single run of the simplest job queue workflow (1 single
task, no db calls by user code in the task - we're just testing db
system overhead) would result in **22 db roundtrips** on drizzle. This
PR reduces it to **17 db roundtrips** by doing the following:

- Modifies db.updateJobs to use the new optimized upsertRow function if
the update is simple
- Do not unnecessarily pass the job log to the final job update when the
workflow completes => allows using the optimized upsertRow function, as
only the main table is involved

---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1210888186878606
This commit is contained in:
Alessio Gravili
2025-07-30 06:23:43 -07:00
committed by GitHub
parent 227a20e94b
commit 3114b89d4c
7 changed files with 164 additions and 76 deletions

View File

@@ -0,0 +1,19 @@
/* eslint-disable no-restricted-exports */
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { getConfig } from './getConfig.js'
const config = getConfig()
import { postgresAdapter } from '@payloadcms/db-postgres'
export const databaseAdapter = postgresAdapter({
pool: {
connectionString: process.env.POSTGRES_URL || 'postgres://127.0.0.1:5432/payloadtests',
},
logger: true,
})
export default buildConfigWithDefaults({
...config,
db: databaseAdapter,
})