diff options
Diffstat (limited to 'src/lib/db/prosodydb.ts')
-rw-r--r-- | src/lib/db/prosodydb.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/db/prosodydb.ts b/src/lib/db/prosodydb.ts index 7c067d2..26687a2 100644 --- a/src/lib/db/prosodydb.ts +++ b/src/lib/db/prosodydb.ts @@ -8,10 +8,13 @@ class DatabaseHandler { db: Database; constructor() { // const dbPath = "/home/y/code/bun/ssr/waku/bulkdata/phon.db"; - const dbPath = "/home/y/code/bun/ssr/waku/bulkdata/thaiphon.db"; + const dbPath = "/home/y/code/bun/ssr/waku/bulkdata/enphon.db"; const db = new Database(dbPath, { create: true }); db.exec("PRAGMA journal_mode = WAL"); // Enable Write-Ahead Logging for better performance db.exec("PRAGMA foreign_keys = ON"); + db.exec("PRAGMA cache_size = -8000"); // Increase cache size to 8MB + db.exec("PRAGMA temp_store = MEMORY"); // Store temp tables in memory + db.exec("PRAGMA synchronous = NORMAL"); // Slightly less safe but faster this.db = db; } async init() { @@ -62,9 +65,8 @@ class DatabaseHandler { FROM words w JOIN word_phonetics wp ON wp.word_id = w.id JOIN syllables_words sw ON sw.word_id = w.id - WHERE w.frequency IS NOT NULL - AND w.lang = ? - ORDER BY w.frequency ASC + WHERE w.lang = ? + ORDER BY w.frequency ASC NULLS LAST LIMIT 300 `, ); |