Subject Re: uniqueidentifier data type and performance
Author Adam
>
> ive got a demo working using the OCTETS character set. my demo is
> using C# to generate the GUIDS before i perform an insert. the
> alternative is for me to use a UDF to generate the GUIDS from within
> Firebird itself. but i really dont see the point of this as its so
> simple to do with C#.NET. is there any reason it might be better for
> me to go down the UDF route?

There is never an 'always better' case. There are pros and cons to
both approaches. I would consider using a UDF + Before Insert Trigger
route, because then it doesn't matter whether it is your .NET app or
someone just running a query in iSQL to batch insert some data, the
primary keys are handled correctly. Another reason is for batch insert
performance, you are then forced to carry the 'over-the-wire' overhead
of the GUID length between your application and the database server.

Firebird 2 introduced a really useful returning clause for an insert
statement, so you can insert the data minus the PK field and have it
return to you the GUID it generates for use in whatever master-detail
relationship you have going at the client. We also do this sort of
thing with generator values with Firebird 1.5 using stored procedures,
but it is less clean.

Adam