From b91b758041cbc7b8bf7e2a4aee8d6228a75d8105 Mon Sep 17 00:00:00 2001 From: polwex Date: Tue, 3 Jun 2025 19:40:34 +0700 Subject: m --- src/lib/db/prosodydb.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/lib/db/prosodydb.ts') 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 `, ); -- cgit v1.2.3