GUIDs (was Re: SQL backend for GnuCash 2)

Phil Longstaff plongstaff at rogers.com
Thu Oct 26 14:49:46 EDT 2006


On Thu, 2006-26-10 at 09:53 -0400, Derek Atkins wrote:
> Mark Johnson <mrj001 at shaw.ca> writes:
> 
> > I may be getting a bit ahead of the play here, since you are talking 
> > about design still, and I am thinking about implementation of it in a 
> > MySql backend.
> >
> > I was recently doing some research on storing GUIDs in MySQL.  There is 
> > no guid type in MySql.  There seems to be two different ways people 
> > store them - as a string (varchar) and as a varbinary.
> 
> I suppose we could use varchar; the guid has a fixed size so we know
> exactly how much space it requires.  It's just an MD5 hash, so it's
> 128 bits, which is 16 bytes of binary or 32 bytes of Hexstring.

I am looking at having an int as the primary key for references to a
table.  The GUID would be stored with the row as 4 ints (guid_1, guid_2,
guid_3 and guid_4).  If we need to search a lot by GUID, we could have
an index which spans those 4 columns.  I don't see there is a lot of
need, though.

GUIDs are currently used as the reference id in the XML format.  In the
SQL format, though, int keys should work fine.  The only need for GUIDs
that I can see is to retain a common set of object ids with past copies
of a file i.e. if I archive some data, the set of accounts and tx data
in the SQL database must have the same ids as the set of accounts and tx
data in the archive.

Phil



More information about the gnucash-devel mailing list