Query optimizations (#478)

* Remove slow and largely pointless groupbys
* Change scene.query to use querybuilder
This commit is contained in:
InfiniteTF
2020-05-11 07:19:11 +02:00
committed by GitHub
parent 328db57d6c
commit 8ba76783b0
9 changed files with 228 additions and 85 deletions

View File

@@ -93,7 +93,7 @@ func (qb *GalleryQueryBuilder) FindByPath(path string) (*Gallery, error) {
}
func (qb *GalleryQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) (*Gallery, error) {
query := "SELECT galleries.* FROM galleries JOIN scenes ON scenes.id = galleries.scene_id WHERE scenes.id = ? LIMIT 1"
query := "SELECT galleries.* FROM galleries WHERE galleries.scene_id = ? LIMIT 1"
args := []interface{}{sceneID}
return qb.queryGallery(query, args, tx)
}