add index in order to be able to count unread entries without join

This commit is contained in:
Athou
2013-07-21 12:37:34 +02:00
parent 71d9d9aeea
commit 0bd06ebc98
2 changed files with 8 additions and 1 deletions

View File

@@ -6,7 +6,7 @@
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">
<named-query name="EntryStatus.unreadCounts">
<query>select sub.id, count(s) from FeedEntryStatus s LEFT JOIN s.subscription sub where sub.user=:user and s.read=false group by sub.id</query>
<query>select s.subscription.id, count(s) from FeedEntryStatus s where s.user=:user and s.read=false group by s.subscription.id</query>
</named-query>
<named-query name="EntryStatus.existing">

View File

@@ -339,4 +339,11 @@
</createIndex>
</changeSet>
<changeSet author="athou" id="create-count-index">
<createIndex indexName="user_read_sub_index" tableName="FEEDENTRYSTATUSES">
<column name="user_id" />
<column name="read_status" />
<column name="subscription_id" />
</createIndex>
</changeSet>
</databaseChangeLog>