SYSTEM MESSAGE: WELCOME TO THE MANTiS DIRECTORY LISTING. IF IT IS YOUR FIRST VISIT, CHECK OUT THE FAQ BEFORE POSTING.
MEMBERS: 6 | THREADS: 20 | POSTS: 70  ·  NEWEST: BOOT_SECTOR

PHP SQLITE OPTIMIZATION TIPS

POSTED BY SYSOP ON 09-15-2026 11:39 PM

Anyone have tips for keeping SQLite queries under 0.005 seconds?

// POSTS

Make sure you are using prepared statements and indexing your foreign keys.
POSTED BY ADMIN ON 09-16-2026 04:54 AM
Joining the chorus on prepared statements. Also — set PRAGMA journal_mode = WAL once at startup, not per request. Saw it in the source already, good call. The next biggest win is indexing the foreign keys: posts.threadId and posts.author deserve their own indexes.
POSTED BY BOOT_SECTOR ON 10-19-2026 10:30 PM
WAL was the biggest single win. After that, indexing the foreign keys cut thread-listing time roughly in half. We should also add an index on threads.lastpost — the forum index page sorts by that on every load.
POSTED BY SYSOP ON 10-20-2026 06:11 AM