Change PK from GUID to INT to improve performance

30 views Asked by At

I'm in the situation of having terrible performance when inserting 10-30k rows into a fairly simple table. Just 4 values. As i don't actually use the PK_ for any lookups its an obvious choice to switch to a auto_increment int as PK_.

This is how i've changed my Datatype.cs

    ... 
    [KeyPropertyName("NewId")]
    ...
    [ImmutableFieldId("73fb2bb9-3eb2-49d8-aebd-dbaa1f1bad33")]
    [StoreFieldType(PhysicalStoreFieldType.Integer, IsNullable = false)]
    [NullIntegerRangeValidator(-2147483648, 2147483647)]
    int NewId { get; set; }

My main question is: How do i define in C1 that this default value should be Identity(1,1), i rather not do this manually in the database.

Secondary questions: Are there any complications of changing PK_ to a int other than the C1 console interface for that datatype no longer working? Can anyone recommend another way of improving performance that is less destructive?

1

There are 1 answers

0
André Eriksen On

I have since my original question come across many similar situations where performance was less that satisfactory. In cases of query lookup's it's extremely helpful to apply a bit of SQL profiler recommendations.

Like described Improve an application performance by adding indexes to a database