I have two databases. One is on mobile and uses SQLite and another one is on Microsoft azure.

I want to sync data in both directions. Sometimes some data is saved on azure db and should be synchronised with SQLite database.

In each table I am using guid field that identifies unique row.

At the moment I have integer as primary key with clustered index and guid as non clustered index which then child table is linked to.

So if I have tables parent and child, I would use guid as parent key and then in child key I would use guidparentid as foreign key. I link relation between parent and child with guid. It is little messy but I make sure I keep clustered index on integer rather guid.

To simplify this I could just use guid as primary key and link all normally, but even if I use newsequentialid() on guid, clustered index on guid is very bad idea.

What would be your suggestion? Should I stick to integer primary key with clustered index and link parent child tables with guids, it should I just upgrade int to guid as primary clustered key?

  • Do you have performance issues? – paparazzo Mar 24 '18 at 11:48
  • I didn’t test anything I am just making sure to have proper design, after reading on internet that guid shouldnt ne clustered due to randomness etc. First time synchronisation scenario didn’t do it before. – sensei Mar 24 '18 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.