logoalt Hacker News

masklinnlast Saturday at 4:29 PM1 replyview on HN

Also foreign_keys has to be set per connection but journal_mode is sticky (it changes the database itself).


Replies

porridgeraisinlast Saturday at 5:14 PM

Yes, if journal_mode was not sticky, a new process opening the db would not know to look for the wal and shm files and read the unflushed latest data from there. On the other hand, foreign key enforcement has nothing to do with the file itself, it's a transaction level thing.

In any case, there is no harm in setting sticky pragmas every connection.