Skip to content

Instantly share code, notes, and snippets.

View jadarnel27's full-sized avatar

Josh Darnell jadarnel27

  • J.S. Walker & Company, Inc.
  • Charlotte, NC
View GitHub Profile
@jadarnel27
jadarnel27 / fake-parallel-plan.sqlplan
Created June 29, 2020 14:45
Serial-Parallel-Plan
<?xml version="1.0" encoding="utf-16"?>
<ShowPlanXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.518" Build="13.0.5102.14" xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan">
<BatchSequence>
<Batch>
<Statements>
<StmtSimple StatementCompId="1" StatementEstRows="5683580" StatementId="1" StatementOptmLevel="FULL" CardinalityEstimationModelVersion="130" StatementSubTreeCost="6821.74" StatementText="SELECT *&#xD;&#xA;INTO #TEMP&#xD;&#xA;FROM Table1 WITH (FORCESEEK)&#xD;&#xA;WHERE IntField1 = 157&#xD;&#xA; AND DateField1 &gt;= '1918-02-19'" StatementType="SELECT INTO" QueryHash="0xA7A8162BBD6386C1" QueryPlanHash="0x9147151587CAA05C" RetrievedFromCache="true" SecurityPolicyApplied="false">
<StatementSetOptions ANSI_NULLS="true" ANSI_PADDING="true" ANSI_WARNINGS="true" ARITHABORT="true" CONCAT_NULL_YIELDS_NULL="true" NUMERIC_ROUNDABORT="false" QUOTED_IDENTIFIER="true" />
<QueryPlan DegreeOfParall
@jadarnel27
jadarnel27 / weird-reads.sql
Last active April 8, 2019 13:59
Weird reads
DECLARE @userId INT = 22656;
DECLARE @postType INT = 1;
SELECT Id
FROM dbo.Posts WITH (INDEX([IX_Posts_OwnerUserId]))
WHERE OwnerUserId = @userId AND PostTypeId = 1;
SELECT Id
FROM dbo.Posts WITH (INDEX([IX_Posts_OwnerUserId]))
WHERE OwnerUserId = 22656 AND PostTypeId = 1
USE [master];
GO
CREATE DATABASE [233445];
GO
USE [233445];
GO
CREATE TABLE dbo.CharacterData