Skip to content

CockroachDB query of dashboard repos is relatively slow  #3239

Closed
@chenjpu

Description

The following query statement is very slow to query in the crdb database
image

SELECT repo_id,
         repo_uid,
         repo_user_id,
         repo_namespace,
         repo_name,
         repo_slug,
         repo_scm,
         repo_clone_url,
         repo_ssh_url,
         repo_html_url,
         repo_active,
         repo_private,
         repo_visibility,
         repo_branch,
         repo_counter,
         repo_config,
         repo_timeout,
         repo_throttle,
         repo_trusted,
         repo_protected,
         repo_no_forks,
         repo_no_pulls,
         repo_cancel_pulls,
         repo_cancel_push,
         repo_cancel_running,
         repo_synced,
         repo_created,
         repo_updated,
         repo_version,
         repo_signer,
         repo_secret,
         build_id,
         build_repo_id,
         build_trigger,
         build_number,
         build_parent,
         build_status,
         build_error,
         build_event,
         build_action,
         build_link,
         build_timestamp,
         build_title,
         build_message,
         build_before,
         build_after,
         build_ref,
         build_source_repo,
         build_source,
         build_target,
         build_author,
         build_author_name,
         build_author_email,
         build_author_avatar,
         build_sender,
         build_params,
         build_cron,
         build_deploy,
         build_deploy_id,
         build_debug,
         build_started,
         build_finished,
         build_created,
         build_updated,
         build_version
    FROM repos
         LEFT JOIN builds ON build_id
                                   = (
                          SELECT DISTINCT ON (build_repo_id) build_id
                            FROM builds
                           WHERE builds.build_repo_id = repos.repo_id
                        ORDER BY build_repo_id, build_id DESC
                      )
         INNER JOIN perms ON perms.perm_repo_uid = repos.repo_uid
   WHERE perms.perm_user_id = _
ORDER BY repo_slug ASC

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