Philipp Hörist pushed to branch storage at gajim / gajim


Commits:
f79830e6 by Philipp Hörist at 2024-04-10T21:25:50+02:00
imprv: Storage: Improve queries

- - - - -


1 changed file:

- gajim/common/storage/archive/storage.py


Changes:

=====================================
gajim/common/storage/archive/storage.py
=====================================
@@ -486,8 +486,8 @@ def get_corrected_message(
         stmt = select(Message).where(
             Message.id == correction.correction_id,
             Message.fk_remote_pk == correction.fk_remote_pk,
-            Message.fk_occupant_pk.is_(correction.fk_occupant_pk),
             Message.fk_account_pk == correction.fk_account_pk,
+            Message.fk_occupant_pk.is_(correction.fk_occupant_pk),
             Message.direction == correction.direction,
         )
 
@@ -616,12 +616,12 @@ def get_days_containing_messages(
                     sa.INTEGER,
                 )
             )
+            .distinct()
             .where(
                 Message.fk_remote_pk == fk_remote_pk,
                 Message.fk_account_pk == fk_account_pk,
                 Message.timestamp.between(start, end),
             )
-            .order_by(Message.timestamp, Message.pk)
         )
 
         self._explain(session, stmt)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/f79830e6f99394bd2d20a06b75571515414e358a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/f79830e6f99394bd2d20a06b75571515414e358a
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to