Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jobs: crdb_internal.jobs and crdb_internal.system_jobs perform poorly #122687

Open
7 tasks
stevendanna opened this issue Apr 19, 2024 · 0 comments
Open
7 tasks
Labels
A-jobs C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. P-3 Issues/test failures with no fix SLA T-jobs
Projects

Comments

@stevendanna
Copy link
Collaborator

stevendanna commented Apr 19, 2024

Describe the problem

As part of a larger project to reduce job system contention in the long term. The payload and progress of all jobs were moved from system.jobs to system.job_info.

While the eventual goal is that control interfaces would not require touching system.job_info, that is not true for the interim state we are currently in.

Most notably, crdb_internal.system_jobs and crdb_internal.jobs (which power commands such as SHOW JOBS and the Jobs page on the DB Console) require reading from system.job_info. And, in the worst case, requires 2 full scans of system.jobs_info which can be several GB in size in large clusters.

The long-term fix for this is two-fold:

  1. Move data required to show basic job status out of the job's payload and progress and into a different table.
  2. Re-write crdb_internal.system_jobs and crdb_internal.jobs as virtual views rather than virtual tables. A virtual view allows the optimizer to plan much more efficient queries and should be able to eliminate the full scans in many more cases.

Ongoing work towards this plan

Related work-arounds and issues:

Jira issue: CRDB-38028

@stevendanna stevendanna added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-jobs labels Apr 19, 2024
@blathers-crl blathers-crl bot added this to Triage in Jobs Apr 19, 2024
@blathers-crl blathers-crl bot added the A-jobs label Apr 19, 2024
@exalate-issue-sync exalate-issue-sync bot added the P-3 Issues/test failures with no fix SLA label Apr 22, 2024
stevendanna added a commit to stevendanna/cockroach that referenced this issue May 8, 2024
The CTE in the query used for crdb_internal.system_jobs can prevent a
number of useful query optimizations.

Informs cockroachdb#122687

Release note (performance improvement): Further improves the
performance of job-system related queries.
stevendanna added a commit to stevendanna/cockroach that referenced this issue May 20, 2024
The CTE in the query used for crdb_internal.system_jobs can prevent a
number of useful query optimizations.

Informs cockroachdb#122687

Release note (performance improvement): Further improves the
performance of job-system related queries.
@stevendanna stevendanna changed the title jobs: crdb_internal.jobs and crdb_internal.show_jobs perform poorly jobs: crdb_internal.jobs and crdb_internal.system_jobs perform poorly May 21, 2024
stevendanna added a commit to stevendanna/cockroach that referenced this issue May 29, 2024
The CTE in the query used for crdb_internal.system_jobs can prevent a
number of useful query optimizations.

Informs cockroachdb#122687

Release note (performance improvement): Further improves the
performance of job-system related queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-jobs C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. P-3 Issues/test failures with no fix SLA T-jobs
Projects
No open projects
Jobs
Triage
Development

No branches or pull requests

1 participant