Skip to content

Conversation

@evgeniy-scherbina
Copy link
Contributor

@evgeniy-scherbina evgeniy-scherbina commented May 21, 2025

Use only online provisioner daemons for GetProvisionerJobsByIDsWithQueuePosition query. It should improve performance of the query.

@evgeniy-scherbina evgeniy-scherbina marked this pull request as ready for review May 21, 2025 17:30
Comment on lines 12 to 13
"github.com/coder/coder/v2/coderd/provisionerdserver"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be grouped with the rest of the github.com/coder/coder/v2 imports. Also, the cdr.dev/slog import should be grouped in with those as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

),
online_provisioner_daemons AS (
SELECT id, tags FROM provisioner_daemons pd
WHERE pd.last_seen_at IS NOT NULL AND pd.last_seen_at >= (NOW() - (@stale_interval_ms::bigint || ' ms')::interval)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a more descriptive param like provisioner_daemon_stale_interval_ms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use @stale_interval_ms everywhere - so I kept it for consistency.

@evgeniy-scherbina evgeniy-scherbina merged commit 110102a into main May 28, 2025
30 checks passed
@evgeniy-scherbina evgeniy-scherbina deleted the yevhenii/optimize-sql-query branch May 28, 2025 12:21
@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants