[Files Refactor] Performance tuning (#2809)

* Use cache during migration
* Avoid use of query views
* Use FindMany to find related objects
* Log slow queries
* Add folders to generated files
* Use SlimScene for scene queries
* Include filename in migration error message
This commit is contained in:
WithoutPants
2022-08-08 14:24:08 +10:00
parent c825cf5d09
commit 569c3a872a
21 changed files with 417 additions and 157 deletions

View File

@@ -557,7 +557,6 @@ func queryFunc(ctx context.Context, query *goqu.SelectDataset, single bool, f fu
return err
}
logger.Tracef("SQL: %s [%v]", q, args)
rows, err := tx.QueryxContext(ctx, q, args...)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
@@ -592,7 +591,6 @@ func querySimple(ctx context.Context, query *goqu.SelectDataset, out interface{}
return err
}
logger.Tracef("SQL: %s [%v]", q, args)
rows, err := tx.QueryxContext(ctx, q, args...)
if err != nil {
return fmt.Errorf("querying `%s` [%v]: %w", q, args, err)