<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>rakoo</author><text>Why do you use a secondary, volatile database ? Performance-wise you won&amp;#x27;t gain a lot more (we&amp;#x27;re talking about a user editing a file, so not even 1 write per second).&lt;p&gt;A proposal: write directly, and automatically in the database. No more Save button. There are multiple advantages:&lt;p&gt;- the system is crash-resistant. I like taking the approach of CouchDB where the only correct way to close the system is to crash it. That way a crash is an expected situation that you actually account for, not a special case that you might forget&lt;p&gt;- there is only one database. Less code, fewer bugs.&lt;p&gt;- it is safe. A write to SQLite works or doesn&amp;#x27;t work, there is no in-between. As said in the VACUUM doc you point to: &amp;quot;However, if the VACUUM INTO command is interrupted by an unplanned shutdown or power lose, then the generated output database might be incomplete and corrupt&amp;quot;&lt;p&gt;- it is how SQLite was intended to work. And because of that, you won&amp;#x27;t have to think about it for the lifetime of SQLite</text><parent_chain><item><author>p4bl0</author><text>I&amp;#x27;m currently working on an application where I use SQLite as the file format. I want to keep a usual workflow for users where you can make edit to your document and it only changes the file when you save it.&lt;p&gt;So to open a file I copy it into the :memory: database [1], then the user can do whatever manipulation they want and I can directly make the change in the database I don&amp;#x27;t need to have a model of the document other than its database format. And to save the document I VACUUM [2] it back to the database file. It works quite well, at least for reasonably sized file (which is always the case for my app) :).&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;inmemorydb.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;inmemorydb.html&lt;/a&gt;&lt;p&gt;[2] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;lang_vacuum.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;lang_vacuum.html&lt;/a&gt;</text></item></parent_chain></comment><story><title>What if OpenDocument used SQLite? (2014)</title><url>https://www.sqlite.org/affcase1.html</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>nextaccountic</author><text>This means that like a regular app, you lose data if the app crashes or there is a power loss.&lt;p&gt;It&amp;#x27;s much better to save after each operation in a temporary place (probably in ~&amp;#x2F;.local&amp;#x2F;share&amp;#x2F;application&amp;#x2F;yourapp, using XDG directories), and when the user clicks save, just copy the file into the desired location. That way, if there is a power loss and you reopen the app, it opens right back where it was doing (losing maybe he last few seconds of changes, but not all unsaved data)</text><parent_chain><item><author>p4bl0</author><text>I&amp;#x27;m currently working on an application where I use SQLite as the file format. I want to keep a usual workflow for users where you can make edit to your document and it only changes the file when you save it.&lt;p&gt;So to open a file I copy it into the :memory: database [1], then the user can do whatever manipulation they want and I can directly make the change in the database I don&amp;#x27;t need to have a model of the document other than its database format. And to save the document I VACUUM [2] it back to the database file. It works quite well, at least for reasonably sized file (which is always the case for my app) :).&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;inmemorydb.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;inmemorydb.html&lt;/a&gt;&lt;p&gt;[2] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;lang_vacuum.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.sqlite.org&amp;#x2F;lang_vacuum.html&lt;/a&gt;</text></item></parent_chain></comment><story><title>What if OpenDocument used SQLite? (2014)</title><url>https://www.sqlite.org/affcase1.html</url></story>