3 ms·
What about DDL, for example creating or altering a table or an index? Will LiteStream replicate the operation?
by ngrilly 5y ago
What about DDL, for example creating or altering a table or an index? Will LiteStream replicate the operation?
- benbjohnson 5y agoGood question. Litestream does physical replication so it simply copies the underlying pages of the database. That means it’ll work with any database changes including DDL or even extensions. One exception to that is encrypted databases like SQLCipher since Litestream needs to be able to read some metadata from the database.
- ngrilly 5y agoThanks Ben! I wasn’t sure if SQLite was storing metadata using the same B-Tree and WAL. As usual with SQLite the documentation about this is excellent: https://sqlite.org/schematab.html https://sqlite.org/schematab.html
- benbjohnson 5y agoYep! The schema storage is kinda wild. They store the DDL for the creation of the objects as the raw SQL which is quite a bit different than how something like Postgres has a bunch of tables in the pg_catalog to specify the database structure.
- ngrilly 5y agoYes, and that’s what makes ALTER TABLE a bit difficult to implement in SQLite, but that’s also simplifying the implementation: https://sqlite.org/lang_altertable.html https://sqlite.org/lang_altertable.html I agree this is quite unexpected for anyone used to PostgreSQL :)