GUIDs (was Re: SQL backend for GnuCash 2)
Benoit Gregoire
bock at step.polymtl.ca
Thu Oct 26 15:35:50 EDT 2006
On Thursday 26 October 2006 14:49, Phil Longstaff wrote:
> 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.
Seriously, the GUID is the real primary key to every object. The SQL schema
should reflect that. Besides, that MySql is slow on varchars is quite
frankly not our problem, they'll fix it eventually. Not to mention that
dealing with serials across databases will add totally useless complexity.
More information about the gnucash-devel
mailing list