So you have only just started doing this
I can add a new attribute the very moment I create a new row.
When I want to add "not_available_before: 2026" to a car, I can do that right away. No need to alter the table and add a new column.
I just named a downside of the columns approach: It slows things down.
Being able to add add fields faster leads to faster experimentation and development.
It will probably become a good idea then to have some clue as to what structure used to be at one point or the other, and for that you’d want to keep track as to what got added/removed and when.
If it’s a very early stage in the development, and you don’t expect any of the current data to survive to the final version, I guess that’s fine. But when you have an actual running product that has to keep running, dealing with the multiple versions of the data scheme is a pain, and dealing with the multiple untracked versions of the data scheme is a pain squared.
You seem to think that using columns somehow results in some type of automatic "tracking" (versioning?) of something.
It should be a multistep process. Yes, it will waste time now, but it will save it in a long run.
Lots of use-cases for SQLite are not like Big Iron SQL Database Of Record where every change must be tracked because it's a shared stateful single point of failure and there's hell to pay for mistakes or confusion.
My understanding is that NoSQL databases still have indexes and it seems like using SQLite as you demonstrate could be worse in that regard.
reasoning behind having no id or key column
The entries in the data column already have an id field. What would be an upside of having another id in a column? It seems that only complicates things and has the potential for invalid states (different id in the id column than in the json field).So far I have not used indexes because things are fast enough as they are. I would expect that when I need more speed, I can easily add indexes on expressions.
Why do you expect SQLite indexes on expressions to be worse than what NoSQL databases do for indexing?
> Why do you expect SQLite indexes on expressions to be worse than what NoSQL databases do for indexing?
I don’t have a concrete reason. It’s just that indexes on expressions are not intended as the main index for a SQLite database to my knowledge. Having thought about it more and read the page on expression indexes more thoroughly[0], I think it’s probably unlikely to be a noticeable downside.
The only remaining downside is that the item being indexed might be outright missing, but it sounds like that’s basically a feature in your case, as you’re opting for flexibility.
Since 2024, all my new database tables have only one column. Everything just goes into one single JSON column, which I always call "data".
I looked around a bit if some NoSql database would make this easier. But it turned out no, even now that I only use Json everywhere, SQLite is still the best tool.