server/tags: improve tag list performance
This commit is contained in:
parent
c21309aa35
commit
3c5878cb16
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
from sqlalchemy.orm import subqueryload, lazyload
|
from sqlalchemy.orm import subqueryload, lazyload, defer
|
||||||
from sqlalchemy.sql.expression import func
|
from sqlalchemy.sql.expression import func
|
||||||
from szurubooru import db
|
from szurubooru import db
|
||||||
from szurubooru.func import util
|
from szurubooru.func import util
|
||||||
|
@ -12,8 +12,11 @@ class TagSearchConfig(BaseSearchConfig):
|
||||||
return db.session.query(db.Tag) \
|
return db.session.query(db.Tag) \
|
||||||
.join(db.TagCategory) \
|
.join(db.TagCategory) \
|
||||||
.options(
|
.options(
|
||||||
|
defer(db.Tag.first_name),
|
||||||
|
defer(db.Tag.suggestion_count),
|
||||||
|
defer(db.Tag.implication_count),
|
||||||
|
defer(db.Tag.post_count),
|
||||||
strategy(db.Tag.names),
|
strategy(db.Tag.names),
|
||||||
strategy(db.Tag.category),
|
|
||||||
strategy(db.Tag.suggestions).joinedload(db.Tag.names),
|
strategy(db.Tag.suggestions).joinedload(db.Tag.names),
|
||||||
strategy(db.Tag.implications).joinedload(db.Tag.names))
|
strategy(db.Tag.implications).joinedload(db.Tag.names))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue