Skip to content

Fix bad query in findAllWorkspaceAndInstances #13225

Closed
@geropl

Description

@geropl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: dbmeta: staleThis issue/PR is stale and will be closed soontype: bugSomething isn't workingtype: incidentGitpod.io service is unstable

    Type

    No type

    Projects

    Status

    In Validation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions