Skip to content

Fix bad query in findAllWorkspaceAndInstances #13225

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

Closed
geropl opened this issue Sep 23, 2022 · 1 comment
Closed

Fix bad query in findAllWorkspaceAndInstances #13225

geropl opened this issue Sep 23, 2022 · 1 comment
Labels
component: db meta: stale This issue/PR is stale and will be closed soon type: bug Something isn't working type: incident Gitpod.io service is unstable

Comments

@geropl
Copy link
Member

geropl commented Sep 23, 2022

This issue was brought up again by this change. We hotfixed the query on the client side with this commit.

After investigation during https://app.incident.io/incidents/217 we found the root cause:

SELECT COUNT(DISTINCT `ws`.`id`) AS `cnt`
    FROM `d_b_workspace` `ws`
        INNER JOIN `d_b_workspace_instance` `wsi`
            ON `wsi`.`id` = (SELECT i.id FROM d_b_workspace_instance AS i WHERE i.workspaceId = `ws`.`id` ORDER BY i.creationTime DESC LIMIT 1)

It's issued from this method. Specifically, the getCount call here is the expensive one.

@stale
Copy link

stale bot commented Dec 23, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Dec 23, 2022
@stale stale bot closed this as completed Jan 3, 2023
@github-project-automation github-project-automation bot moved this to In Validation in 🍎 WebApp Team Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: db meta: stale This issue/PR is stale and will be closed soon type: bug Something isn't working type: incident Gitpod.io service is unstable
Projects
Status: In Validation
Development

No branches or pull requests

2 participants