Skip to content

Instantly share code, notes, and snippets.

View tangdf's full-sized avatar

tangdf tangdf

  • china 武汉
View GitHub Profile
@tangdf
tangdf / String_Serialize_Test.cs
Last active December 29, 2017 07:56
字符串序列化,去空格
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Xunit;
using Xunit.Abstractions;
namespace UnitTest
@tangdf
tangdf / Callvirt_Call.cs
Last active November 27, 2017 07:37
Callvirt vs Call
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using AspectCore.Extensions.Reflection.Emit;
using Xunit;
namespace AspectCore.Extensions.Reflection.Test
{
-- Identifying Unused Indexes in SQL Server
SELECT OBJECT_NAME(s.[object_id]) AS [Table Name] ,
i.name AS [Index Name] ,
i.fill_factor ,
user_updates AS [Total Writes] ,
user_seeks + user_scans + user_lookups AS [Total Reads] ,
user_updates - ( user_seeks + user_scans + user_lookups ) AS [Difference]
FROM sys.dm_db_index_usage_stats AS s WITH ( NOLOCK )
INNER JOIN sys.indexes AS i WITH ( NOLOCK ) ON s.[object_id] = i.[object_id]
AND i.index_id = s.index_id
SELECT DISTINCT CONVERT(DECIMAL(18, 2) , user_seeks * avg_total_user_cost * ( avg_user_impact * 0.01 )) AS [index_advantage] ,
migs.last_user_seek ,
mid.[statement] AS [Database.Schema.Table] ,
mid.equality_columns ,
mid.inequality_columns ,
mid.included_columns ,
migs.unique_compiles ,
migs.user_seeks ,
migs.avg_total_user_cost ,
migs.avg_user_impact ,
--测式SQL语句:
With UIDs As
( -- 0 1 2 3 4 5 6 7 8 9 A B C D E F
Select 1 AS Id,
Cast('00000000000000000000010000000000' As Raw(16)) as "UID"
from dual
Union
Select 2 AS ID,