Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 25 Nov 2009 @ 17:57:22 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: GUID/UUID generation in UDF
 
From:   Victor Sokovin

Kaare,

Looks like you are getting closer to your goal. Thanks for the clarification. First time I read your initial posting I thought you were looking for the way to create universal identifiers for some objects (strings). Hence, my suggestion of MD5. This method allows generation of consistent IDs using a formula (or algorithm), without keeping the administration. But in fact you would rather keep the administration in favor of truly unique counters.


  Unfortunately there are still a few questions to be answered: 1. Is it possible to allocate a memory address once and then let my UDF "increase and fetch" a value each time it's running?  


We are in the world of Teradata and, in general, priority is given to parallel processing. I don't know whether performance is of concern for your case but if we look at the mechanism Teradata uses to generate IDs for their so called IDENTITY columns we see that it is done in a more complex way. We had quite a few discussions on this in the past. I don't know whether you are familiar with this particular subject but here is a small selection of threads that covers typical issues encountered with ID generation in a parallel environment:

www.teradataforum.com/teradata/20071129_144237.htm

www.teradataforum.com/teradata/20090411_162945.htm

www.teradataforum.com/teradata/20091014_091231.htm


The last thread is especially good because it shows how counter ranges are (pre-)allocated per AMP, with all advantages and disadvantages of this method.


  2. Can I access some sort of clock from a UDF? (If this is a problem, > CURRENT_TIME(6) can be an input parameter to the UDF. I can live with that :-)  


The thing with UDF is that every U is different. Who can tell in advance whether such a clock will be available in all cases? Perhaps you need to ship one with your UDF if you want to be sure.


  3. Can I access the MAC address of the machine from a UDF? If not, are there any other node or amp identifiers that could be used. (It could maybe be passed in as a parameter, if necessary)  


Good question but it is getting difficult to answer it. We live in the times of mass virtualization, servers divided in strange "zones" and what not. I guess you have to be more practical handling OS by OS and version by version.


  I have some experience with C++ and know that this is possible in a "normal" program context. But I also realize that a UDF runs in a special context that may not allow calls to the standard platform libraries.  


Very true, and I don't have a universal solution here. If you intend to ship the UDF with a standard Teradata client, try to restrict the libraries to the ones used by Teradata. Good chance that they will be available.


Victor



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023