Skip to content
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

Improve sql efficiency for getting the run #1835

Merged
merged 1 commit into from
Aug 15, 2019
Merged

Improve sql efficiency for getting the run #1835

merged 1 commit into from
Aug 15, 2019

Conversation

IronPan
Copy link
Member

@IronPan IronPan commented Aug 14, 2019

Original query

SELECT
   subq.*,
   CONCAT("[", GROUP_CONCAT(r.Payload SEPARATOR ", "), "]") AS refs 
FROM
   (
      SELECT
         rd.*,
         CONCAT("[", GROUP_CONCAT(m.Payload SEPARATOR ", "), "]") AS metrics 
      FROM
         (
            SELECT
               UUID,
               DisplayName,
               Name,
               StorageState,
               Namespace,
               Description,
               CreatedAtInSec,
               ScheduledAtInSec,
               FinishedAtInSec,
               Conditions,
               PipelineId,
               PipelineSpecManifest,
               WorkflowSpecManifest,
               Parameters,
               pipelineRuntimeManifest,
               WorkflowRuntimeManifest 
            FROM
               run_details
         )
         AS rd 
         LEFT JOIN
            run_metrics AS m 
            ON rd.UUID = m.RunUUID 
      GROUP BY
         rd.UUID
   )
   AS subq 
   LEFT JOIN
      (
         select
            * 
         from
            resource_references 
         where
            ResourceType = 'Run'
      )
      AS r 
      ON subq.UUID = r.ResourceUUID 
WHERE
   UUID = 'a0af02a9-bacb-11e9-a841-42010ad4009a' 
GROUP BY
   subq.UUID LIMIT 1;

This can be improved by moving the where clause to the first select statement.

This change is Reviewable

@IronPan
Copy link
Member Author

IronPan commented Aug 14, 2019

/assign @hongye-sun

@IronPan
Copy link
Member Author

IronPan commented Aug 14, 2019

/retest

Copy link
Contributor

@hongye-sun hongye-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@IronPan
Copy link
Member Author

IronPan commented Aug 14, 2019

/test kubeflow-pipeline-e2e-test

1 similar comment
@IronPan
Copy link
Member Author

IronPan commented Aug 14, 2019

/test kubeflow-pipeline-e2e-test

@IronPan
Copy link
Member Author

IronPan commented Aug 14, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: IronPan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@IronPan
Copy link
Member Author

IronPan commented Aug 14, 2019

/test kubeflow-pipeline-e2e-test

@IronPan IronPan merged commit 1e9c14f into master Aug 15, 2019
@IronPan IronPan deleted the IronPan-patch-8 branch August 16, 2019 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants