Re: Keys larger than 2 Billion -How do you do it?
Posted in 1996
I have asked this question of Mark Stock off list but my mail appears not to have gotten through. Perhaps someone else can clarify a question for a dummy like me. Mark refers to an ability to affect the value of a insert record using the before clause in an insert trigger. Nils seems to support that this can be done by saying 'Don't do it!'. I have been advised in the past by informix support that it *cannot* be done. And being of low mental capacity am unable to find out myself using TFM how it *could* be done. In the past we have thought that we might like to do this, so that we could deploy generic applications across our distributed database and have unique keys generated that wouldn't crap out on being replicated. This is not a load situation, but a moderately volumed OLTP app. If anyone knows how it can be done, please post the code as this would be nice to know. TIA. -- -- Peter Tashkoff <tashkop@kiwi.co.nz> NZ Kiwifruit Marketing Board Usual disclaimers apply. This posting may not be used by any party to vilify another. >>> Nils Myklebust <Nils.Myklebust@idg.no> 18/September/1996 04:36am >>> "Mark D. Stock" <marks@west.co.za> wrote: :Leonid Belov wrote: :> :> Serial key will be unique across the whole table regardless of what you use :> as primary key - single column or composite key. If you want to have :> so much rows you _cannot_ use serial column :Weeeell, you can drop the system index and create a composite index with the :serial column. Actually a very elegant solution, if the serial datatype keeps going round robin. (You might want to test that, or check with Informix.) A simple time field in addition would make it unique. :> You cannot use insert-trigger because you need to modify same table in your :> INSERT statement and in the trigger. It seems to me that your idea with :> control table is only reasonable for Informix. :If you use an insert trigger it gives you the NEW record BEFORE it is :inserted. So you can lookup the next key from another table and set the key :field BEFORE allowing the insert. I definitly wouldn't do this. With the volume of data you will have to insert having such a trigger fire for every row inserted would slow down the process very significantly. There are even new options now (I assume they have allways been there in XPS) to turn off indexing while doing mass loads. Nils.Myklebust@idg.no <- New E-mail adress NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company