summaryrefslogtreecommitdiff
path: root/src/lib/db/prosodydb.ts
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-06-03 19:40:34 +0700
committerpolwex <polwex@sortug.com>2025-06-03 19:40:34 +0700
commitb91b758041cbc7b8bf7e2a4aee8d6228a75d8105 (patch)
tree4fa343ed394034b16841ecfcb6411b1574d24b25 /src/lib/db/prosodydb.ts
parent175ddca375cef765cec8ca5bbc527a205c40bf25 (diff)
m
Diffstat (limited to 'src/lib/db/prosodydb.ts')
-rw-r--r--src/lib/db/prosodydb.ts10
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
`,
);