Architect generates SQL for tables with clustered primary key

Architect currently generates SQL for tables with clustered primary key. It has to be NONCLUSTERED.

The reason why primary keys should generally be NONCLUSTERED indexes is that the records are saved into the table in the physical order of the clustered index. If the primary key would be auto-increasing number, everything would be nice as the records would always stack up in the table.

But since the primary key in ORIGAM is Uniqueidentifier by default, which is a random number, every time new record is saved the WHOLE TABLE has to be REORDERED so the new row would fit physically sorted between some other random rows. This probably never makes any sense for Guid primary keys. For big tables this can kill the database because potentially millions of records have to be physically reordered whenever new record is added.

See more details here:

It disappeared in this commit

This is the place where it has to say PRIMARY KEY NONCLUSTERED for Microsoft SQL Server as it is unfortunately CLUSTERED by default.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.