<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlserver.ro/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Diverse</title><link>http://sqlserver.ro/forums/27/ShowForum.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2327.aspx</link><pubDate>Wed, 25 Jul 2007 15:53:57 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2327</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2327.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2327</wfw:commentRss><description>&lt;p&gt;Ok... oricum, avind in vedere ca am (nolock) - banui ca e folosirea (nolock) e mai buna decit folosirea (updlock) in SQL Server&lt;/p&gt;&lt;p&gt;Am verificat scriptul&amp;nbsp; - si merge la fel cu (nolock) ...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2325.aspx</link><pubDate>Wed, 25 Jul 2007 13:29:17 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2325</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2325.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2325</wfw:commentRss><description>&lt;p&gt;Sorry again...&lt;img src="http://sqlserver.ro/emoticons/emotion-10.gif" alt="Embarrassed" /&gt;&lt;/p&gt;&lt;p&gt;http://www.sql-server-performance.com/reducing_locks_hints.asp&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2324.aspx</link><pubDate>Wed, 25 Jul 2007 13:28:31 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2324</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2324.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2324</wfw:commentRss><description>Imi cer scuze...scriptul din Inside SQL Server 2000 poate fi rulat din mai multe conexiuni simultan daca folosesti UPDLOCK...&lt;br&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2323.aspx</link><pubDate>Wed, 25 Jul 2007 13:28:03 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2323</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2323.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2323</wfw:commentRss><description>&lt;p&gt;Diana - vad ca updlock se foloseste pentru SELECT , nu pentru UPDATE . Si, pe deasupra , 1. eu folosesc nolock pentru select si 2. scriptul nu se deadlock la 1 run - ci la 2 concurente&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In articolul recomandata nu vad&amp;nbsp; &lt;span class="textBold"&gt;"locking
                escalation behavior ... for a specific index&lt;/span&gt;"&lt;/p&gt;&lt;p&gt;Imi poti da linkul, te rog ?&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2322.aspx</link><pubDate>Wed, 25 Jul 2007 13:21:54 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2322</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2322.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2322</wfw:commentRss><description>&lt;p&gt;Un exemplu din Inside SQL Server 2000:&lt;/p&gt;
&lt;pre&gt;USE&amp;nbsp;pubs&lt;br&gt;SET&amp;nbsp;TRANSACTION&amp;nbsp;ISOLATION&amp;nbsp;LEVEL&amp;nbsp;REPEATABLE&amp;nbsp;READ&lt;br&gt;BEGIN&amp;nbsp;TRAN&lt;br&gt;SELECT&amp;nbsp;*&amp;nbsp;FROM&amp;nbsp;authors&amp;nbsp;(&lt;font&gt;UPDLOCK&lt;/font&gt;)&amp;nbsp;WHERE&amp;nbsp;au_id='172-32-1176'&lt;br&gt;--&amp;nbsp;Add&amp;nbsp;5&amp;nbsp;sec&amp;nbsp;sleep&amp;nbsp;to&amp;nbsp;widen&amp;nbsp;the&amp;nbsp;window&amp;nbsp;for&amp;nbsp;the&amp;nbsp;deadlock&lt;br&gt;WAITFOR&amp;nbsp;DELAY&amp;nbsp;'00:00:05'&amp;nbsp;&lt;br&gt;UPDATE&amp;nbsp;authors&amp;nbsp;SET&amp;nbsp;au_lname='Updated&amp;nbsp;by&amp;nbsp;'&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+&amp;nbsp;CONVERT(varchar,&amp;nbsp;@@spid)&amp;nbsp;WHERE&amp;nbsp;au_id='172-32-1176'&lt;br&gt;COMMIT&amp;nbsp;TRAN&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;Ceva asemenator aici:&lt;/p&gt;&lt;p&gt;http://mikedimmick.blogspot.com/2004/03/selectupdate-problem-or-why-updlock.html&lt;/p&gt;&lt;p&gt;* Putzin "off topic" - in articolul de mai jos, vezi "&lt;span class="textBold"&gt;locking
                escalation behavior ... for a specific index&lt;/span&gt;"&lt;br&gt;
&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2321.aspx</link><pubDate>Wed, 25 Jul 2007 13:08:18 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2321</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2321.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2321</wfw:commentRss><description>&lt;p&gt;nu folosesc alt isolation level decit cel default ... am incercat sa il pun pe minim dar tot nu am reusit.&lt;/p&gt;&lt;p&gt;Scuza-ma ca te pun la munca, dar poti sa imi indici exact linkul catre un exemplu de update care foloseste updlock ?Si care e cel mai "mic" ? UPDLock ?&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2320.aspx</link><pubDate>Wed, 25 Jul 2007 13:01:34 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2320</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2320.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2320</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;/p&gt;&lt;p&gt;NOLOCK, READUNCOMMITED&amp;nbsp;&lt;/p&gt;&lt;p&gt;Specifies that dirty reads are allowed. No shared locks are issued to prevent 
other transactions from modifying data read by the current transaction, and 
exclusive locks set by other transactions do not block the current transaction 
from reading the locked data.&lt;/p&gt;

UPDLOCK
Specifies that update locks are to be taken and held until the transaction 
completesAcquiring an update lock does not prevent others from reading the same data, but 
it does ensure that you're first in line to upgrade your lock to an exclusive 
lock if you subsequently decide to modify the locked data &lt;br&gt;


&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;* "quote"din Books Online si Inside SQL Server 2000*&lt;/p&gt;&lt;p&gt;Pentru "update" se pot folosi:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; FASTFIRSTROW &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|&lt;b&gt; &lt;/b&gt;HOLDLOCK &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| PAGLOCK &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| READCOMMITTED &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| REPEATABLEREAD &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| ROWLOCK &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| SERIALIZABLE &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| TABLOCK &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| TABLOCKX &lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| UPDLOCK  
&lt;/p&gt;&lt;p&gt;&amp;nbsp;- lista figureaza in BOL SQL 2005 sub numele de "table hint limited".&amp;nbsp;&lt;br&gt;
 &lt;/p&gt;&lt;p&gt;* Folosesti cumva alt "isolation level" decat cel "default"?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2318.aspx</link><pubDate>Wed, 25 Jul 2007 12:35:18 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2318</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2318.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2318</wfw:commentRss><description>&lt;p&gt;WITH (UPDLOCK) - e mai tare decit with(nolock) ?&lt;/p&gt;&lt;p&gt;Se poate folosi si la update?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2317.aspx</link><pubDate>Wed, 25 Jul 2007 12:04:21 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2317</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2317.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2317</wfw:commentRss><description>Incearca sa folosesti WITH (UPDLOCK) la operatiile pe tabela Y.&lt;br&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2316.aspx</link><pubDate>Wed, 25 Jul 2007 11:45:59 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2316</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2316.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2316</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://sqlserver.ro/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Diana:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Cum arata scriptul pe care il folosesti?&lt;br&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;Mare * in principiu am spus ce face&lt;/p&gt;&lt;p&gt;&amp;nbsp;"&amp;lt;operatii, printre care si select din Y si din X with(nolock) &amp;gt;&lt;/p&gt;&lt;p&gt;inserez in Y cu null pe idx1 de mai multe ori (maxim 10, dupa cite am observat) si cu acelasi idz1 &lt;br&gt;&lt;/p&gt;&lt;p&gt;insert in X si&amp;nbsp; iau valoarea lui idx1&lt;/p&gt;&lt;p&gt;fac update pe Y cu&amp;nbsp; idx1 obtinut where idz1 = valoareIDz1 si idx1 is null&lt;/p&gt;&lt;p&gt;&amp;lt;operatii&amp;gt; &lt;br&gt;&lt;/p&gt;&lt;p&gt;"&amp;nbsp;&lt;/p&gt;&lt;p&gt;Ce te-ar mai putea interesa&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2315.aspx</link><pubDate>Wed, 25 Jul 2007 11:27:45 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2315</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2315.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2315</wfw:commentRss><description>Cum arata scriptul pe care il folosesti?&lt;br&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2314.aspx</link><pubDate>Wed, 25 Jul 2007 11:21:35 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2314</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2314.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2314</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://sqlserver.ro/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;ggciubuc:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;Dupa cate imi dau seama acel "cimp PK idx1" este identity (ca din cate stiu nu poate o cheie primara sa fie null), apoi il folosesti pentru a actualiza Y; eu zic sa folosesti functia SCOPE_IDENTITY&lt;b&gt;() care da ultimul identity bagat.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;Folosesc scope_identity ... alta idee?&lt;br&gt;&lt;/p&gt;</description></item><item><title>Re: sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2313.aspx</link><pubDate>Wed, 25 Jul 2007 11:19:36 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2313</guid><dc:creator>ggciubuc</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2313.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2313</wfw:commentRss><description>&lt;P&gt;Dupa cate imi dau seama acel "cimp PK idx1" este identity (ca din cate stiu nu poate o cheie primara sa fie null), apoi il folosesti pentru a actualiza Y; eu zic sa folosesti functia SCOPE_IDENTITY&lt;B&gt;() care da ultimul identity bagat.&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item><item><title>sql 2000, deadlock si index</title><link>http://sqlserver.ro/forums/thread/2312.aspx</link><pubDate>Wed, 25 Jul 2007 10:34:37 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2312</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2312.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=27&amp;PostID=2312</wfw:commentRss><description>&lt;p&gt;Am 2 tabele:&lt;/p&gt;&lt;p&gt;1. X - cimp PK idx1, cimp x1(numar rinduri aprox 2.000.000)&lt;br&gt;&lt;/p&gt;&lt;p&gt;2. Y - cimp PK&amp;nbsp; idy1, cimp FK idx1 , cimp idz1, cimp valoare (nr rinduri aprox 3.000.000)&lt;br&gt;792&lt;br&gt;&lt;/p&gt;&lt;p&gt;Am index pe FK idX1 pe tabela Y pentru rapiditate &lt;br&gt;&lt;/p&gt;&lt;p&gt;Am facut un&amp;nbsp; script de testare, care consta, in afara de select*uri pe X si pe Y, in urmatoarele:&lt;/p&gt;&lt;p&gt;inserez in Y cu null pe idx1 de mai multe ori (maxim 10, dupa cite am observat) si cu acelasi idz1 &lt;br&gt;&lt;/p&gt;&lt;p&gt;insert in X si&amp;nbsp; iau valoarea lui idx1&lt;/p&gt;&lt;p&gt;fac update pe Y cu&amp;nbsp; idx1 obtinut where idz1 = valoareIDz1 si idx1 is null&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Ei, pe acest update da deadlock daca rulez 2 script-uri concurent . &lt;br&gt;&lt;/p&gt;&lt;p&gt;Transaction (Process ID 85) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;(Cum stiu ca pe update&amp;nbsp; - dupa ce am citit pe net tot felul de tot felul despre dead=lock - cum se vad - si l-am vazut, pina la urma, din Sql Server Logs + scriind la print-uri de am turbat ... Am pus si SQL Server Profiler si am vazut si acolo liniile ...)&lt;/p&gt;&lt;p&gt;Ce e ciudat este ca se updateaza doar 2-10 rinduri&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Daca rulez un singur script nu da eroare&lt;/p&gt;&lt;p&gt;Daca scot index-ul de pe&amp;nbsp; IdX1 de pe tabela Y - pot sa rulez si 100 de script-uri concurent&amp;nbsp; - tot nu da eroare, dar dureaza ca naiba.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Stiti cumva ce as putea face -nu sa schimb codul - este ultima optiune&amp;nbsp;&lt;img src="http://sqlserver.ro/emoticons/emotion-12.gif" alt="Angry" /&gt;&amp;nbsp; - ca sa nu mai dea deadlock ?&lt;/p&gt;&lt;p&gt;&amp;nbsp;Baza de date este SQL 2000&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>