Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #1998 > unrolled thread
| Started by | Anton Shepelev <anton.txt@gmail.com> |
|---|---|
| First post | 2017-11-29 23:38 +0300 |
| Last post | 2017-11-30 13:58 +0300 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.databases.ms-sqlserver
Alternative to WAITFOR DELAY Anton Shepelev <anton.txt@gmail.com> - 2017-11-29 23:38 +0300
Re: Alternative to WAITFOR DELAY Erland Sommarskog <esquel@sommarskog.se> - 2017-11-29 22:49 +0100
Re: Alternative to WAITFOR DELAY Anton Shepelev <anton.txt@g{oogle}mail.com> - 2017-11-30 13:58 +0300
| From | Anton Shepelev <anton.txt@gmail.com> |
|---|---|
| Date | 2017-11-29 23:38 +0300 |
| Subject | Alternative to WAITFOR DELAY |
| Message-ID | <20171129233836.16edaac99510193c72857910@gmail.com> |
Hello, all Is there a more granular way to ease a tight polling loop in T-SQL than WAITFOR DEALAY? A delay of 3.33 milliseconds being a tad too long for my purposes, I seek a way to implement delays of about half a mil- lisecond or shorter. I do not need the precision of real-time systems and will accept any solution to prevent a fast WHILE 1=1 loop from hogging the CPU. -- () ascii ribbon campaign -- against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
[toc] | [next] | [standalone]
| From | Erland Sommarskog <esquel@sommarskog.se> |
|---|---|
| Date | 2017-11-29 22:49 +0100 |
| Message-ID | <XnsA83CE82FF733BYazorman@127.0.0.1> |
| In reply to | #1998 |
Anton Shepelev (anton.txt@gmail.com) writes: > Is there a more granular way to ease a tight polling > loop in T-SQL than WAITFOR DEALAY? A delay of 3.33 > milliseconds being a tad too long for my purposes, I > seek a way to implement delays of about half a mil- > lisecond or shorter. I do not need the precision of > real-time systems and will accept any solution to > prevent a fast WHILE 1=1 loop from hogging the CPU. > I guess that you could write a CLR procedure for the task.
[toc] | [prev] | [next] | [standalone]
| From | Anton Shepelev <anton.txt@g{oogle}mail.com> |
|---|---|
| Date | 2017-11-30 13:58 +0300 |
| Message-ID | <20171130135858.38dd51d2bc9dc3114279db70@g{oogle}mail.com> |
| In reply to | #1999 |
Erland Sommarskog to Anton Shepelev: >>Is there a more granular way to ease a tight >>polling loop in T-SQL than WAITFOR DEALAY? A de- >>lay of 3.33 milliseconds being a tad too long for >>my purposes, I seek a way to implement delays of >>about half a millisecond or shorter. I do not >>need the precision of real-time systems and will >>accept any solution to prevent a fast WHILE 1=1 >>loop from hogging the CPU. > >I guess that you could write a CLR procedure for >the task. Thanks. No idea why it didn't occur to me. I have written .NET assemblies for MSSQL before. If per- formace testing shows a need for a shorter delay I will definitely follow your advice. Meanwhile, my loop switches to zero delay once it finds work to do, and back to a 3.3 ms delay once all work is done and in incoming queue is empty. -- () ascii ribbon campaign - against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
[toc] | [prev] | [standalone]
Back to top | Article view | comp.databases.ms-sqlserver
csiph-web