Skip to content

Commit

Permalink
add a composite index for next scheduled
Browse files Browse the repository at this point in the history
  • Loading branch information
domino14 committed Dec 23, 2024
1 parent f4b3118 commit 5681e25
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/exp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
// Some experimentation code to figure out this API.
func main() {
p := fsrs.DefaultParam()
// p.EnableShortTerm = false
// p.EnableFuzz = true
// p.MaximumInterval = 365 * 5
p.EnableShortTerm = false
p.EnableFuzz = true
p.MaximumInterval = 365 * 5
card := fsrs.NewCard()
now := time.Now()
card.Due = now
f := fsrs.NewFSRS(p)
card.Stability = 1000000
card.Difficulty = 1
// card.Stability = 1000000
// card.Difficulty = 1
card.State = fsrs.New // this needs to be set if changing the stab/diff manually.
for range 10 {
schedulingCards := f.Repeat(card, card.Due)
Expand Down
5 changes: 5 additions & 0 deletions db/migrations/000004_composite_idx_schedule.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BEGIN;

DROP INDEX IF EXISTS idx_cards_user_lexicon_scheduled;

COMMIT;
6 changes: 6 additions & 0 deletions db/migrations/000004_composite_idx_schedule.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BEGIN;

CREATE INDEX IF NOT EXISTS idx_cards_user_lexicon_scheduled
ON wordvault_cards (user_id, lexicon_name, next_scheduled);

COMMIT;

0 comments on commit 5681e25

Please sign in to comment.