On Mar 9, 6:32 am, Axel Schwenke <axel.schwe...@gmx.de> wrote:
> Lee Peedin <lpeedinDONOTSP...@nc.rr.com> wrote:
> > On Fri, 9 Mar 2007 11:13:34 +0100, Axel Schwenke
> > <axel.schwe...@gmx.de> wrote:
>
> >>> How do database experts store GUIDs in database tables? I plan to
> >>> index these GUIDs.
>
> >>If you can afford the extra work for assembling/dissembling - use two
> >>BIGINT UNSIGNED columns. Otherwise DECIMAL(39) would fit as well and
> >>allow you to input/output the number as a whole.
>
> > Given that GUIDs are most often written as a sequence of hexadeciamal
> > digits "seperated" by hyphens, isn't storing these as anything other
> > than "char" going to mean that "the extra work for
> > assembling/dissembling" will always be required?
>
> Hmm. I read about that GUID stuff now and the "hex-with-hyphens" format
> looks quite arbitrary to me. Since it is basically a 128-bit number,
> I would prefer to store it as such.
>
> > {3F2504E0-4F89-11D3-9A0C-0305E82C3301}
>
> Of course one could store it as CHAR(36) or even CHAR(38) - but that
> would mean:
>
> - waste of storage space, resulting in
> - performance impact
> and last not least
> - possibility to have invalid GUIDs - we need to check integrity
>
> The "silver bullet" would be a native 128-bit INTEGER type and a GUID
> data format a'la SELECT CONVERT(uid_col AS GUID) FROM ...
>
> XL
> --
> Axel Schwenke, Support Engineer, MySQL AB
>
> Online User Manual:http://dev.mysql.com/doc/refman/5.0/en/
> MySQL User Forums: http://forums.mysql.com/
Thanks. Any chance that MySQL will provide this "silver bullet" at
some point? ;-)
Looking through MSDN, Microsoft seems to have UNIQUEINDENTIFIER data
type. This is a 16-byte identifier.
Combine that with NEWID( ) function and ROWGUIDCOL constraint, and I
have exactly what I am looking for.
-Steve