Guid Primary /Foreign Key dilemma SQL Server

后端 未结 5 1736
情话喂你
情话喂你 2020-12-08 08:32

I am faced with the dilemma of changing my primary keys from int identities to Guid. I\'ll put my problem straight up. It\'s a typical Retail management app, with POS and ba

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 09:19

    GUIDs do have a performance impact relative to ints, but that impact may be minimal depending on your application so there's no way to be certain without testing. I once converted over an application from ints to GUIDs with some very large tables with many foreign keys doing both very heavy modifications and queries (on the order of hundreds of thousands of records turning over daily.) Things were a slower when run through a profiler, but there wasn't a noticeable difference from the user's perspective.

    So the answer is "it depends." Like all things dealing with performance, you can't really be sure until you try it.

提交回复
热议问题