mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-05 01:59:44 +01:00
fix: change sql to improve the performance of catalog api (#14820)
Signed-off-by: chlins <chlins.zhang@gmail.com>
This commit is contained in:
parent
8600b06975
commit
a50f782beb
@ -16,7 +16,6 @@ package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
o "github.com/astaxie/beego/orm"
|
||||
@ -160,7 +159,7 @@ func (d *dao) NonEmptyRepos(ctx context.Context) ([]*model.RepoRecord, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sql := fmt.Sprintf(`select distinct r.* from repository as r LEFT JOIN tag as t on r.repository_id = t.repository_id where t.repository_id is not null;`)
|
||||
sql := `select * from repository where repository_id in (select distinct repository_id from tag)`
|
||||
_, err = ormer.Raw(sql).QueryRows(&repos)
|
||||
if err != nil {
|
||||
return repos, err
|
||||
|
Loading…
Reference in New Issue
Block a user