Skip to content

Commit

Permalink
fix: get conversation members is causing a full table scan (#1891)
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara authored Jul 17, 2023
1 parent 26c567c commit 0979362
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ DELETE FROM Member WHERE conversation = ? AND user = ?;
deleteMembersFromConversation:
DELETE FROM Member WHERE conversation = ?;

-- TODO: replace LIKE with absolute value
selectAllMembersByConversation:
SELECT * FROM Member WHERE conversation LIKE ('%' || :searchQuery || '%');
SELECT * FROM Member WHERE conversation = :conversation;

selectConversationByMember:
SELECT * FROM Member
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ internal class MemberDAOImpl internal constructor(
}

override suspend fun observeConversationMembers(qualifiedID: QualifiedIDEntity): Flow<List<MemberEntity>> {
return memberQueries.selectAllMembersByConversation(qualifiedID.value)
return memberQueries.selectAllMembersByConversation(qualifiedID)
.asFlow()
.flowOn(coroutineContext)
.mapToList()
Expand Down

0 comments on commit 0979362

Please sign in to comment.