mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 10:11:25 +08:00
Remove indexes which used accountId as the first param... not faster
This commit is contained in:
parent
cf7b8f1a47
commit
3e5312dc39
4 changed files with 4 additions and 6 deletions
|
@ -158,8 +158,7 @@ class Message extends Model
|
|||
|
||||
@additionalSQLiteConfig:
|
||||
setup: ->
|
||||
['CREATE INDEX IF NOT EXISTS MessageListIndex ON Message(account_id, thread_id, date ASC)',
|
||||
'CREATE INDEX IF NOT EXISTS MessageListThreadIndex ON Message(thread_id, date ASC)',
|
||||
['CREATE INDEX IF NOT EXISTS MessageListThreadIndex ON Message(thread_id, date ASC)',
|
||||
'CREATE INDEX IF NOT EXISTS MessageListDraftIndex ON Message(account_id, draft)',
|
||||
'CREATE UNIQUE INDEX IF NOT EXISTS MessageDraftIndex ON Message(client_id)',
|
||||
'CREATE UNIQUE INDEX IF NOT EXISTS MessageBodyIndex ON MessageBody(id)']
|
||||
|
|
|
@ -100,7 +100,7 @@ class Thread extends Model
|
|||
|
||||
@additionalSQLiteConfig:
|
||||
setup: ->
|
||||
['CREATE INDEX IF NOT EXISTS ThreadListIndex ON Thread(account_id, last_message_received_timestamp DESC, id)']
|
||||
['CREATE INDEX IF NOT EXISTS ThreadListIndex ON Thread(last_message_received_timestamp DESC, id)']
|
||||
|
||||
fromJSON: (json) ->
|
||||
super(json)
|
||||
|
|
|
@ -211,7 +211,7 @@ class MessageStore extends NylasStore
|
|||
loadedThreadId = @_thread.id
|
||||
|
||||
query = DatabaseStore.findAll(Message)
|
||||
query.where(threadId: loadedThreadId, accountId: @_thread.accountId)
|
||||
query.where(threadId: loadedThreadId)
|
||||
query.include(Message.attributes.body)
|
||||
query.then (items) =>
|
||||
# Check to make sure that our thread is still the thread we were
|
||||
|
|
|
@ -198,8 +198,7 @@ class CategoryMailboxPerspective extends MailboxPerspective
|
|||
super(other) and _.isEqual(@categories(), other.categories())
|
||||
|
||||
threads: =>
|
||||
query = DatabaseStore
|
||||
.findAll(Thread)
|
||||
query = DatabaseStore.findAll(Thread)
|
||||
.where([Thread.attributes.categories.containsAny(_.pluck(@categories(), 'id'))])
|
||||
.limit(0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue