This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
not sure whether this is true but as a new user I will ask as there is only one id in the key table then the total number of records for a database is limited to that of int32 or approx 4billion? does the insert method actually read this value each time?
|
|
|
Our default KeyTable scripts generally use INT which is usually 32-bit and therefore limited to 4 billion. However you can customise these to use BIGINT or your database platform's equivalent. In this case be sure to declare your entities' identity type as Int64 rather than Int32. The insert method does not read the value each time: instead it "reads" a "block" of values determined by the LightSpeedContext.IdentityBlockSize (default 10). That is, when LightSpeed needs new IDs from the KeyTable, it gets the current value and increments the value in the database by the IdentityBlockSize; and it it allocates IDs from that { retrieved value .. incremented value - 1 } range until it runs out, at which point it goes back to the database for a new block. |
|
|
I appreciate the guidance I was working with Vistadb and even when I adjust the value I still get odd results Should I be allocating a value larger than my inserted items? |
|
|
If you have an existing database then yes, the starting value for the KeyTable should be larger than any existing ID, or you may get clashes. Otherwise, there shouldn't be any problems. Is this what you meant by "allocating a value larger than my inserted items" or have I misunderstood? What are the "odd results" you are seeing? |
|
|
WHOOPS, I meant the block size I tried a number of 5000 on an incert of 100,000 records amd it failed thanx |
|
|
That certainly should work, though of course it will require 20 updates to the KeyTable. Can you say a bit more about the failure? Was there an exception? Could you provide us with the message and stack trace? If you turn on SQL logging (via e.g. LightSpeedContext.Logger = new TraceLogger()), what is the generated SQL? Are there any existing records in the table you're inserting into? Thanks! |
|
|
You also want to make sure there is 1 row in your keytable. I messed up and had an empty key table and ended up with key violations the second time my app ran. Joe |
|
|
Ivan, I will do the test and send a more complete example on the weekend. I have to say that I am very impressed with the LightSpeed compared to the three other ORM packages we have used. Cheers, |
|