[GNC] Database storage

Jim DeLaHunt list+gnucash at jdlh.com
Fri Sep 20 19:23:19 EDT 2024


Chris:

On 2024-09-20 06:32, Chris Miller via gnucash-user wrote:
> Hi Jim,
>
>> Beware of confusion: the word "transaction" is already used on this list
>> to mean an "accounting record of an exchange of value". But I suspect
>> that here you use the word "transaction" to mean a "controlled and
>> reliable change to data stored in a database".
> Yes. They are similar. Both represent "atomic" updates, meaning "all or nothing".

But your question, to which my paragraph above is a reply, was, "Are 
transactions implemented?" In the context of GnuCash, the difference 
between these two meanings of the word "transaction" matters a lot.

(And does the accounting meaning of "transaction" really contain the 
implication of "atomic"? I suspect not, but I am not an accountant.)

>>> * Are transactions implemented? -- Let's assume, "Yes."
> Let's assume, "No." (-: Apparently SQLite represent zero improvement over the flat file storage.
>
> Is there a way to update backing store anytime I make a change, and not periodically? It seems like leaving updates lying around in memory is a good way to lose updates when the dog pulls the plug out of the wall.

Yes. The GnuCash application's "Save" toolbar button and menu item 
update backing store.

On 2024-09-20 07:29, Chris Miller wrote:
> Oh! Do I understand the GnuCash parses the data and stores it in 
> database tables? --- like one table for each account? Or are all the 
> rows going to be the same with each row being an accounting 
> transaction "acct 1 $X.XX acct 2 -$X.XX"? What about "splits"?

To learn about the database structure which GnuCash uses, here are some 
good places to start reading:

  * <https://wiki.gnucash.org/wiki/SQL>. Last updated April 2024, and
    may well be out of date in places, but also may well be helpful for
    the most part.
  * <https://wiki.gnucash.org/wiki/GnuCash_SQL_Examples>. Last updated
    October 2022. Same cautions apply.
  * <https://github.com/Gnucash/gnucash/tree/stable/libgnucash/backend/sql>.
    Part of the GnuCash source code related to database storage.

While we are at it, here are some FAQ entries relevant to this thread, 
which have not yet been cited:

"Q: Can I use GnuCash with multiple users? Maybe via the SQL backend? A: 
That depends on what you mean exactly.…"
<https://wiki.gnucash.org/wiki/FAQ#Q:_Can_I_use_GnuCash_with_multiple_users.3F_Maybe_via_the_SQL_backend.3F>

"SQL Database. Q: Is there a database backend?…"
<https://wiki.gnucash.org/wiki/FAQ#SQL_Database>

Might I suggest, as you explore the SQL structures you find in your 
GnuCash book database, you make corrections to parts of the Wiki pages 
which are wrong?  Help the next person who asks the same questions.

Best regards,
       —Jim DeLaHunt


More information about the gnucash-user mailing list