This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- configure recommended DB option | |
ALTER DATABASE CURRENT SET MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT=ON; | |
GO | |
-- validate tier | |
IF (DatabasePropertyEx(DB_Name(), 'IsXTPSupported') = 0) | |
BEGIN | |
PRINT 'This database does not support in-mem database.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PARTITION FUNCTION year_partition_function (varchar(4)) AS | |
RANGE FOR VALUES ('2019', '2020', '2021') | |
GO | |
CREATE PARTITION SCHEME year_partition_scheme AS | |
PARTITION year_partition_function ALL TO ([PRIMARY]) | |
GO | |
CREATE TABLE users | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data; | |
using System.Data.SqlClient; | |
internal class Program | |
{ | |
static int threads = 0; | |
static int records = 0; | |
static int batch = 10_000; | |
static DateTime started = DateTime.Now; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET NOCOUNT ON | |
DECLARE @json NVARCHAR(MAX) = | |
'{ | |
"reading": { | |
"source": "A01", | |
"values": [ | |
{ "date": "2022-12-12", "value": 123.456 } | |
, { "date": "2022-12-13", "value": 234.567 } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Dynamic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
using System.Text.Json; | |
using System.Xml.Linq; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Engines; | |
using BenchmarkDotNet.Running; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS #SSN | |
CREATE TABLE #SSN ( | |
ID INT IDENTITY(1, 1) PRIMARY KEY | |
, SSN VARCHAR(11) MASKED WITH (FUNCTION = 'partial(0, "XXX-XX-", 4)') | |
, SEX BIT | |
, BIRTH INT | |
) | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Library.Models; | |
using Library.EF; | |
namespace Abstractions | |
{ | |
public interface IKeyedModel | |
{ | |
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] | |
public int Id { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DBCC DROPCLEANBUFFERS; | |
CHECKPOINT; | |
DBCC FREEPROCCACHE WITH no_infomsgs; | |
GO | |
CREATE OR ALTER FUNCTION Range (@start BIGINT, @end BIGINT) | |
RETURNS @table TABLE (Id BIGINT) AS | |
BEGIN | |
-- Jerry Nixon |