HomePhabricator
Diffusion Comm 2ea66c63800b

[SQLite] Add target_message generated column and index

Description

[SQLite] Add target_message generated column and index

Summary:
Generated colums in SQLite are described this way in the docs:

Generated columns (also sometimes called "computed columns") are columns of a table whose values are a function of other columns in the same row. Generated columns can be read, but their values can not be directly written. The only way to change the value of a generated column is to modify the values of the other columns used to calculate the generated column.

I found them from this blog post, which explains how to use a generated column and index to efficiently query on the contents of a JSON column in SQLite. I found that blog post from this Reddit comment.

Test Plan:

  1. I confirmed I could compile and run this on both iOS and web
  2. I checked the EXPLAIN QUERY PLAN for the query I use this index for (in a later diff) and it showed the index being used:

Screenshot 2024-07-15 at 5.15.00 PM.png (654×1 px, 314 KB)

Reviewers: kamil, tomek, marcin

Reviewed By: tomek

Differential Revision: https://phab.comm.dev/D12759

Details

Provenance
ashoatAuthored on Jul 15 2024, 10:30 AM
Reviewer
tomek
Differential Revision
D12759: [SQLite] Add target_message generated column and index
Parents
rCOMMd1c2b00e9d7c: [web] add std::optional (C++) <-> undefined (JS) marshalling
Branches
Unknown
Tags
Unknown