add index for average factor calculation

This commit is contained in:
Damien Elmes 2009-06-06 17:32:51 +09:00
parent 82e8555793
commit 598b2e79e9

View file

@ -50,7 +50,7 @@ SEARCH_TAG = 0
SEARCH_TYPE = 1 SEARCH_TYPE = 1
SEARCH_PHRASE = 2 SEARCH_PHRASE = 2
SEARCH_FID = 3 SEARCH_FID = 3
DECK_VERSION = 35 DECK_VERSION = 36
deckVarsTable = Table( deckVarsTable = Table(
'deckVars', metadata, 'deckVars', metadata,
@ -2712,6 +2712,10 @@ create index if not exists ix_cards_duePriority on cards
deck.s.statement(""" deck.s.statement("""
create index if not exists ix_cards_priorityDue on cards create index if not exists ix_cards_priorityDue on cards
(type, isDue, combinedDue, priority)""") (type, isDue, combinedDue, priority)""")
# average factor
deck.s.statement("""
create index if not exists ix_cards_factor on cards
(type, factor)""")
# card spacing # card spacing
deck.s.statement(""" deck.s.statement("""
create index if not exists ix_cards_factId on cards (factId, type)""") create index if not exists ix_cards_factId on cards (factId, type)""")
@ -3129,9 +3133,9 @@ nextFactor, reps, thinkingTime, yesCount, noCount from reviewHistory""")
deck.updateDynamicIndices() deck.updateDynamicIndices()
deck.version = 34 deck.version = 34
deck.s.commit() deck.s.commit()
if deck.version < 35: if deck.version < 36:
DeckStorage._addIndices(deck) DeckStorage._addIndices(deck)
deck.version = 35 deck.version = 36
deck.s.commit() deck.s.commit()
# executing a pragma here is very slow on large decks, so we store # executing a pragma here is very slow on large decks, so we store
# our own record # our own record