Langsung ke konten
Skillpedia
Database18k · #10714

sqlite-expert

Fungsinya

Skill ini memandu penggunaan SQLite sebagai basis data tertanam berkas tunggal, termasuk pengaturan performa, transaksi, dan pencarian teks penuh. Skill ini untuk pengembang yang membangun aplikasi kecil, aplikasi seluler, perangkat, atau cache lokal.

Kapan dipakai

  • ✓Saat Anda membangun aplikasi atau perangkat kecil yang menyimpan data dalam satu berkas SQLite.
  • ✓Saat SQLite menampilkan galat sibuk dan memerlukan pengaturan akses konkuren yang lebih baik.
  • ✓Saat Anda memerlukan pencarian teks penuh di dalam basis data SQLite.

Link skill

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/sqlite-expert/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/sqlite-expert/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Siapkan SQLite untuk aplikasi catatan kecil saya agar pembacaan dan penulisan berjalan lancar bersamaan, dan tambahkan pencarian di judul serta isi catatan.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill ini merekomendasikan write-ahead logging, batas waktu sibuk, transaksi eksplisit yang singkat, indeks yang masuk akal, dan ekstensi FTS5 untuk pencarian teks penuh.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

SQLite Expert

A database specialist with deep expertise in SQLite internals, performance tuning, and embedded database patterns. This skill provides guidance for using SQLite effectively in applications ranging from mobile apps and IoT devices to server-side caching layers and analytical workloads, leveraging its advanced features well beyond simple key-value storage.

Key Principles

  • Enable WAL mode (PRAGMA journal_mode=WAL) for concurrent read/write access; it allows readers to proceed without blocking writers and vice versa
  • Use PRAGMA busy_timeout to set a reasonable wait duration (e.g., 5000ms) instead of receiving SQLITE_BUSY errors immediately on contention
  • Design schemas with appropriate indexes from the start; SQLite's query planner relies heavily on index availability for efficient execution plans
  • Keep transactions short and explicit; wrap related writes in BEGIN/COMMIT to ensure atomicity and reduce fsync overhead
  • Understand that SQLite is serverless and single-file; its strength is simplicity and reliability, not high-concurrency multi-writer workloads

Techniques

  • Set performance PRAGMAs at connection open: journal_mode=WAL, synchronous=NORMAL, cache_size=-64000 (64MB), mmap_size=268435456, temp_store=MEMORY
  • Use FTS5 for full-text search: CREATE VIRTUAL TABLE docs USING fts5(title, body) with MATCH queries and bm25() ranking
  • Query JSON data with the JSON1 extension: json_extract(), json_each(), json_group_array() for document-style data stored in TEXT columns
  • Write recursive CTEs (WITH RECURSIVE) for tree traversal, graph walking, and generating series of values
  • Use window functions (ROW_NUMBER, LAG, LEAD, SUM OVER) for running totals, rankings, and time-series analysis without self-joins
  • Create covering indexes that include all columns needed by a query to enable index-only scans (verified with EXPLAIN QUERY PLAN showing COVERING INDEX)
  • Implement UPSERT with INSERT ... ON CONFLICT (column) DO UPDATE SET for atomic insert-or-update operations

Common Patterns

  • Multi-database Access: Use ATTACH DATABASE to query across multiple SQLite files in a single connection, joining tables from different databases
  • Application-defined Functions: Register custom scalar or aggregate functions in your host language for domain-specific computations inside SQL queries
  • Incremental Vacuum: Use PRAGMA auto_vacuum=INCREMENTAL with periodic PRAGMA incremental_vacuum to reclaim space without a full VACUUM lock
  • Schema Migration: Use PRAGMA user_version to track schema version and apply migration scripts sequentially on application startup

Pitfalls to Avoid

  • Do not open multiple connections with different PRAGMA settings; WAL mode and other PRAGMAs should be set consistently on every connection
  • Do not use SQLite for high-concurrency write workloads with dozens of simultaneous writers; consider PostgreSQL or another client-server database instead
  • Do not store large BLOBs (over 1MB) inline; SQLite performs better when large objects are stored as external files with paths referenced in the database
  • Do not skip EXPLAIN QUERY PLAN during development; without it, slow full-table scans go unnoticed until production load reveals them
Pertanyaan umum

Apa itu mode WAL?

Itu adalah mode jurnal yang memungkinkan pembaca tetap berjalan saat penulis bekerja, sehingga membantu akses konkuren.

Apakah SQLite cocok untuk banyak penulis sekaligus?

Skill ini menyatakan SQLite paling kuat untuk penyimpanan berkas tunggal yang sederhana dan andal, bukan beban kerja konkurensi tinggi dengan banyak penulis.

Apa yang dilakukan batas waktu sibuk?

Itu membuat SQLite menunggu kunci selama waktu tertentu, alih-alih langsung gagal ketika penulisan lain sedang berjalan.

Detail

Deskripsi asli dari pembuat

SQLite expert for WAL mode, query optimization, embedded patterns, and advanced features

repo: RightNow-AI/openfang

Popularitas

Bintang GitHub
18k
Peringkat
#10714
Lisensi
Apache-2.0
Diperbarui
2/7/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa