This file contains hidden or 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
| public class TaskQueue | |
| { | |
| private readonly ConcurrentQueue<Func<Task>> _processingQueue = new ConcurrentQueue<Func<Task>>(); | |
| private readonly ConcurrentDictionary<int, Task> _runningTasks = new ConcurrentDictionary<int, Task>(); | |
| private readonly int _maxParallelizationCount; | |
| private readonly int _maxQueueLength; | |
| private TaskCompletionSource<bool> _tscQueue = new TaskCompletionSource<bool>(); | |
| public TaskQueue(int? maxParallelizationCount = null, int? maxQueueLength = null) | |
| { |
This file contains hidden or 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
| //events - a super-basic Javascript (publish subscribe) pattern | |
| var events = { | |
| events: {}, | |
| on: function (eventName, fn) { | |
| this.events[eventName] = this.events[eventName] || []; | |
| this.events[eventName].push(fn); | |
| }, | |
| off: function(eventName, fn) { | |
| if (this.events[eventName]) { |
This file contains hidden or 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
| SELECT top 2000 execquery.last_execution_time AS [Date Time], execsql.text AS [Script] FROM sys.dm_exec_query_stats AS execquery | |
| CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql | |
| where execsql.text like '%textoparaprocurar%' | |
| ORDER BY execquery.last_execution_time DESC |
This file contains hidden or 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
| SELECT | |
| o.name as 'TableName' , | |
| SUM ( | |
| CASE | |
| WHEN (index_id < 2) THEN row_count | |
| ELSE 0 | |
| END | |
| ) as 'RowCount', | |
| LTRIM (STR (SUM (reserved_page_count)/1024 * 8, 15, 0) + ' MB') as'Reserved MB', |
This file contains hidden or 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 TRACEON(8666) | |
| --GO | |
| SELECT qt.text [Comando], | |
| CP.usecounts [Qtd Executado], | |
| cp.size_in_bytes [TamanhoBytes], | |
| cp.objtype [TipoConsulta], | |
| qp.query_plan [ExecutionPlan] | |
| FROM sys.dm_exec_cached_plans cp | |
| CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle) qp |