File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ USE tempdb
2
+ GO
3
+
4
+ -- Garantir que ha memória suficiente
5
+
6
+
7
+ -- Gerar uma tabela com a massa de dados suficiente pro teste e estatíticas manipuladas pra enganar o SQL e ele gerar paralelismo.
8
+ IF OBJECT_ID (' #TabTest1' ) IS NOT NULL
9
+ DROP TABLE #TabTest1;
10
+ CREATE TABLE #TabTest1(Col1 CHAR (500 ));
11
+ INSERT INTO #TabTest1
12
+ SELECT TOP 20000000 -- > --> Você pode ajustar a quantidade de linhas conforme o ambiente. Isso impacta na memoria requerida.
13
+ CONVERT (CHAR (100 ), ' Test, fixed data to be used on test' ) AS Col1
14
+ FROM master .dbo .sysobjects A,
15
+ master .dbo .sysobjects B,
16
+ master .dbo .sysobjects C,
17
+ master .dbo .sysobjects D
18
+ OPTION (MAXDOP 1 );
19
+ GO
20
+ UPDATE STATISTICS #TabTest1 WITH ROWCOUNT = 100000 , PAGECOUNT = 10000
21
+
22
+ -- Garantir que toda a tabela vai estar em memória.
23
+ SELECT COUNT (* ) FROM #TabTest1
24
+
25
+
26
+ SET STATISTICS IO , TIME ON
27
+ GO
28
+
29
+ -- Ajustar o maxdop de 2 em 2 e ir comparando co o outro
30
+ print ' MAXDOP 1'
31
+ SELECT TOP 100 * FROM #TabTest1
32
+ ORDER BY Col1
33
+ OPTION (MAXDOP 1 )
34
+
35
+ print ' MAXDOP 2'
36
+ SELECT TOP 100 * FROM #TabTest1
37
+ ORDER BY Col1
38
+ OPTION (MAXDOP 2 )
39
+
40
+ print ' MAXDOP 4'
41
+ SELECT TOP 100 * FROM #TabTest1
42
+ ORDER BY Col1
43
+ OPTION (MAXDOP 4 )
44
+
45
+ SET STATISTICS IO , TIME OFF
46
+ GO
You can’t perform that action at this time.
0 commit comments