From 3c5878cb16530ed5ec3175d19ca6a6e883297c00 Mon Sep 17 00:00:00 2001 From: rr- Date: Sat, 27 Aug 2016 16:08:01 +0200 Subject: [PATCH] server/tags: improve tag list performance --- server/szurubooru/search/configs/tag_search_config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/szurubooru/search/configs/tag_search_config.py b/server/szurubooru/search/configs/tag_search_config.py index 9ce839d..4595d82 100644 --- a/server/szurubooru/search/configs/tag_search_config.py +++ b/server/szurubooru/search/configs/tag_search_config.py @@ -1,4 +1,4 @@ -from sqlalchemy.orm import subqueryload, lazyload +from sqlalchemy.orm import subqueryload, lazyload, defer from sqlalchemy.sql.expression import func from szurubooru import db from szurubooru.func import util @@ -12,8 +12,11 @@ class TagSearchConfig(BaseSearchConfig): return db.session.query(db.Tag) \ .join(db.TagCategory) \ .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.category), strategy(db.Tag.suggestions).joinedload(db.Tag.names), strategy(db.Tag.implications).joinedload(db.Tag.names))