Skip to content

A slow SQL query is causing high database load #12134

Closed
@liji-canva

Description

@liji-canva

By checking our AWS RDS metrics, we found that one slow query is consuming a lot of database resource and causing high database load.

This is the query -- name: GetDeploymentDAUs :many SELECT (created_at at TIME ZONE cast($1::integer as text))::date as date, user_id FROM workspace_agent_stats WHERE connection_count > ? GROUP BY date, user_id ORDER BY date ASC

We may have a query or table to optimise here. The avg latency per call is 42s for a single query.
Screenshot 2024-02-14 at 2 26 07 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions