数据库中如果用GUID作主键(默认聚簇索引),会产生页面碎片,可以用UUID来解决这个问题:

 

        [DllImport("rpcrt4.dll", SetLastError = true)]
        private static extern int UuidCreateSequential(out Guid guid);
        /// <summary>
        /// 创建有序的 guid。
        /// </summary>
        /// <returns></returns>
        public static Guid CreateSequentialGuid()
        {
            Guid result;
            UuidCreateSequential(out result);
            return result;
        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2021-07-01
  • 2021-11-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-03-02
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2021-07-08
相关资源
相似解决方案