Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Note that you don't actually need the generated column either, SQLite supports indexes on expressions, so you can do, for example,

  CREATE INDEX subjectidx ON messages(json_extract(headers, '$.Subject'))
and it will use this index anywhere you reference that expression.

I find it useful to create indexes like this, then create VIEWs using these expressions instead of ALTER'ing the main table with generated columns.



And since view and indexes don't change the data, you can use tools like https://github.com/fsaintjacques/recordlite to automate schema management.


This is cool! I quite like this.


What a great timely tip. Was just looking for good direction on how to do this. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: