tursodatabase / tursodatabase/libsql

Does SQLite have HOT updates, and optimized row updates?

Open
#1,236 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Two related questions:

  1. If a non-indexed column is updated, are the indexes updated? I believe this should be the case, since its a very simple optimization but with big benefits. I found this function in the SQLite codebase, which I believe implements this: static int indexColumnIsBeingUpdated().

  2. And a similar but important question: If a row has a large blob (10mb), does updating a non-blob field (e.g. "name") re-write the entire blob? I believe this should not be the case, since large blobs are stored via "overflow pages". However, I see this quote on the main SQLite forums, which makes me doubt: When any part of the row is changed the WHOLE row is re-written. This means that if you put a 4 GB blob as the last column of a table with 4 other data fields before it, whenever you update one of the other 4 fields you will re-write the entire record INCLUDING the 4 GB blob which you will have to both read into memory and write back out to disk, perhaps multiple times. This is one of the reasons that large blobs (and text fields, which are the same thing, just with overloaded meaning) should be stored in their own table.

Anyone know for sure?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SQLite's indexColumnIsBeingUpdated() function and the cited SQLite forum statement. Determine how non-indexed column updates affect indexes and large BLOB overflow pages, then document the confirmed behavior and any relevant limitations.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, sqlite
Domain
databases
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.