Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Filter query: has-agent connecting, connected, disconnected, timeout #5145
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
Filter query: has-agent connecting, connected, disconnected, timeout #5145
Changes from 23 commits
ee6577d
7d61519
b5a1ecc
dca2b8b
0a4746c
70952e1
7965a54
c1bd839
2af4133
f9e2167
45957c1
66892d7
fc93f90
e587b5d
458a8eb
81d9fef
5ca8c17
ec2d571
4b2f831
3c0d4fe
9067a9e
c14663c
9c2f64a
44bf343
598b140
f3787d1
ba13e03
d74b072
4255448
4ace659
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you also CTE'd the
latest_build
query, like this:You could join
latest_builds
inworkspace_builds_agents
to reduce the agent results to the latest build only. This should make the query more performant (reduced rows).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good suggestion, but won't it be a problem that
latest_build
goes over all workspaces?I presume that we will need
latest_builds
(plural) for every workspace, but I'm not sure if it isn't the same complexity.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I investigated a few concepts we talked about offline with @mafredri:
latest_build
withworkspace_latest_builds
CTE.Unfortunately, I wasn't able to select only the last build per workspace.
workspace_build_agent
CTE withJOIN LATERAL
.Workspaces with multiple agents will return multiple records, which is unexpected.
It looks like the conditional logic will fire only if
has-agent
is specified and it shouldn't affect otherGetWorkspaces
queries.Let me know your thoughts.