Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12963 articles
Browse latest View live

Deadlock while running multiple UPDATE statements

$
0
0

Isolationlevel="Read committed"

Multiple UPDATE statements are made to a Table which has only 1 Unique Clustered Index.InterestList_ID is the column which has the index.The update statements are getting deadlocked.

The graph is mentioned below.Its clear that Row level locking is not happening here as the update statements are for different rows within the table.

Is the reason just because a clustered Index Scan is happening for the Update statements or there are anything else which needs to be isolated here.

What best course of action can be taken for situation like these where there will be lot of UPDATES going on for a table and reduce potential dead locks.

<deadlock-list>
 <deadlock victim="process5f3f438">
  <process-list>
   <process id="process52e1828" taskpriority="0" logused="580" waitresource="KEY: 202:72057594178240512 (e50029fd93f1)" waittime="15109" ownerId="593539985" transactionname="user_transaction" lasttranstarted="2012-05-02T10:52:08.423" XDES="0x395bf6cb0" lockMode="U" schedulerid="4" kpid="5544" status="suspended" spid="186" sbid="0" ecid="0" priority="0" transcount="2" lastbatchstarted="2012-05-02T10:52:19.680" lastbatchcompleted="2012-05-02T10:52:19.640" clientapp=".Net SqlClient Data Provider" hostname="WAFFFAPARAPP10" hostpid="2328" loginname="PAN" isolationlevel="read committed (2)" xactid="593539985" currentdb="202" lockTimeout="4294967295" clientoption1="671088928" clientoption2="128056">
    <executionStack>
     <frame procname="adhoc" line="1" stmtstart="864" sqlhandle="0x02000000a9f8ba394e9a78b74f96de323de665be8b852ba0">
UPDATE [Customers_PHMD_Interests] set [Registered_Date] = @1,[Lead_Source] = @2,[Region] = @3,[MPC_Community] = @4,[Neighborhood] = @5,[Preferred_State] = @6,[Comments] = @7,[PhoneNumber] = @8,[AddressLine1] = @9,[City] = @10,[State] = @11,[ZipCode] = @12,[LicenceNo] = @13,[Builder] = @14,[PlanName] = @15,[PriceRange] = @16,[PreferredMarket] = @17,[BestContact] = @18,[HowHeard] = @19,[TimeFrame] = @20,[PANCorporate] = @21,[Updt_User_ID] = @22,[Updt_DateTime] = getdate(),[Uptd_Prgm] = @23,[PreferredProperty] = @24  WHERE [InterestList_ID]=@25     </frame>
     <frame procname="adhoc" line="1" sqlhandle="0x02000000a162ac072885f023e4c59de30982cc11d01151e4">
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;9/2/2009 6:21:02 PM&apos;, Lead_Source = &apos;NewHomeSource&apos;, Region = &apos;3&apos;,  MPC_Community = &apos;12&apos;,  Neighborhood = &apos;59&apos;,  Preferred_State = &apos;CA&apos;, Comments = &apos;Lead Type: Brochure&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;746 N E St.&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;&apos;,  PriceRange = &apos;&apos;, PreferredMarket = &apos;Riverside-San Bernardino&apos;,BestContact = &apos;&apos;, HowHeard = &apos;NewHomeSource&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;&apos; WHERE  InterestList_ID = &apos;NHS_3290&apos;     </frame>
    </executionStack>
    <inputbuf>
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;9/2/2009 6:21:02 PM&apos;, Lead_Source = &apos;NewHomeSource&apos;, Region = &apos;3&apos;,  MPC_Community = &apos;12&apos;,  Neighborhood = &apos;59&apos;,  Preferred_State = &apos;CA&apos;, Comments = &apos;Lead Type: Brochure&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;746 N E St.&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;&apos;,  PriceRange = &apos;&apos;, PreferredMarket = &apos;Riverside-San Bernardino&apos;,BestContact = &apos;&apos;, HowHeard = &apos;NewHomeSource&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;&apos; WHERE  InterestList_ID = &apos;NHS_3290&apos;    </inputbuf>
   </process>
   <process id="process5f23198" taskpriority="0" logused="0" waitresource="KEY: 202:72057594178240512 (e50029fd93f1)" waittime="25015" ownerId="593539009" transactionname="user_transaction" lasttranstarted="2012-05-02T10:52:04.433" XDES="0x95e63850" lockMode="U" schedulerid="7" kpid="4516" status="suspended" spid="275" sbid="0" ecid="0" priority="0" transcount="2" lastbatchstarted="2012-05-02T10:52:09.793" lastbatchcompleted="2012-05-02T10:52:09.753" clientapp=".Net SqlClient Data Provider" hostname="WAFFFAPARAPP10" hostpid="2328" loginname="PAN" isolationlevel="read committed (2)" xactid="593539009" currentdb="202" lockTimeout="4294967295" clientoption1="671088928" clientoption2="128056">
    <executionStack>
     <frame procname="adhoc" line="1" stmtstart="864" sqlhandle="0x02000000a9f8ba394e9a78b74f96de323de665be8b852ba0">
UPDATE [Customers_PHMD_Interests] set [Registered_Date] = @1,[Lead_Source] = @2,[Region] = @3,[MPC_Community] = @4,[Neighborhood] = @5,[Preferred_State] = @6,[Comments] = @7,[PhoneNumber] = @8,[AddressLine1] = @9,[City] = @10,[State] = @11,[ZipCode] = @12,[LicenceNo] = @13,[Builder] = @14,[PlanName] = @15,[PriceRange] = @16,[PreferredMarket] = @17,[BestContact] = @18,[HowHeard] = @19,[TimeFrame] = @20,[PANCorporate] = @21,[Updt_User_ID] = @22,[Updt_DateTime] = getdate(),[Uptd_Prgm] = @23,[PreferredProperty] = @24  WHERE [InterestList_ID]=@25     </frame>
     <frame procname="adhoc" line="1" sqlhandle="0x02000000b98a333343228e3ceb5c872637265e0c72213120">
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;5/1/2012 1:55:42 PM&apos;, Lead_Source = &apos;Inquiry User Profile&apos;, Region = &apos;&apos;,  MPC_Community = &apos;&apos;,  Neighborhood = &apos;&apos;,  Preferred_State = &apos;&apos;, Comments = &apos;&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;&apos;,  PriceRange = &apos;&apos;, PreferredMarket = &apos;&apos;,BestContact = &apos;&apos;, HowHeard = &apos;&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;&apos; WHERE  InterestList_ID = &apos;_8814&apos;    </frame>
    </executionStack>
    <inputbuf>
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;5/1/2012 1:55:42 PM&apos;, Lead_Source = &apos;Inquiry User Profile&apos;, Region = &apos;&apos;,  MPC_Community = &apos;&apos;,  Neighborhood = &apos;&apos;,  Preferred_State = &apos;&apos;, Comments = &apos;&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;&apos;,  PriceRange = &apos;&apos;, PreferredMarket = &apos;&apos;,BestContact = &apos;&apos;, HowHeard = &apos;&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;&apos; WHERE  InterestList_ID = &apos;_8814&apos;   </inputbuf>
   </process>
   <process id="process5f3f438" taskpriority="0" logused="0" waitresource="KEY: 202:72057594178240512 (da00f8bc7ead)" waittime="13796" ownerId="593540033" transactionname="user_transaction" lasttranstarted="2012-05-02T10:52:08.423" XDES="0x80835760" lockMode="U" schedulerid="9" kpid="2456" status="suspended" spid="204" sbid="0" ecid="0" priority="0" transcount="2" lastbatchstarted="2012-05-02T10:52:19.740" lastbatchcompleted="2012-05-02T10:52:19.700" clientapp=".Net SqlClient Data Provider" hostname="WAFFFAPARAPP10" hostpid="2328" loginname="PAN" isolationlevel="read committed (2)" xactid="593540033" currentdb="202" lockTimeout="4294967295" clientoption1="671088928" clientoption2="128056">
    <executionStack>
     <frame procname="adhoc" line="1" stmtstart="864" sqlhandle="0x02000000a9f8ba394e9a78b74f96de323de665be8b852ba0">
UPDATE [Customers_PHMD_Interests] set [Registered_Date] = @1,[Lead_Source] = @2,[Region] = @3,[MPC_Community] = @4,[Neighborhood] = @5,[Preferred_State] = @6,[Comments] = @7,[PhoneNumber] = @8,[AddressLine1] = @9,[City] = @10,[State] = @11,[ZipCode] = @12,[LicenceNo] = @13,[Builder] = @14,[PlanName] = @15,[PriceRange] = @16,[PreferredMarket] = @17,[BestContact] = @18,[HowHeard] = @19,[TimeFrame] = @20,[PANCorporate] = @21,[Updt_User_ID] = @22,[Updt_DateTime] = getdate(),[Uptd_Prgm] = @23,[PreferredProperty] = @24  WHERE [InterestList_ID]=@25     </frame>
     <frame procname="adhoc" line="1" sqlhandle="0x020000009afcb025a39b753277d383c3ac8e9d9e7f164d7b">
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;9/3/2009 1:06:05 AM&apos;, Lead_Source = &apos;NewHomeSource&apos;, Region = &apos;10&apos;,  MPC_Community = &apos;3&apos;,  Neighborhood = &apos;6&apos;,  Preferred_State = &apos;CA&apos;, Comments = &apos;Lead Type: Events and Promotions&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;91320&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;3A 3A&apos;,  PriceRange = &apos;818000.00&apos;, PreferredMarket = &apos;San Diego&apos;,BestContact = &apos;&apos;, HowHeard = &apos;NewHomeSource&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;0021 5893 GABLEWOOD WAY&apos; WHERE  InterestList_ID = &apos;NHS_3293&apos;     </frame>
    </executionStack>
    <inputbuf>
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;9/3/2009 1:06:05 AM&apos;, Lead_Source = &apos;NewHomeSource&apos;, Region = &apos;10&apos;,  MPC_Community = &apos;3&apos;,  Neighborhood = &apos;6&apos;,  Preferred_State = &apos;CA&apos;, Comments = &apos;Lead Type: Events and Promotions&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;91320&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;3A 3A&apos;,  PriceRange = &apos;818000.00&apos;, PreferredMarket = &apos;San Diego&apos;,BestContact = &apos;&apos;, HowHeard = &apos;NewHomeSource&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;0021 5893 GABLEWOOD WAY&apos; WHERE  InterestList_ID = &apos;NHS_3293&apos;    </inputbuf>
   </process>
   <process id="process6b652e8" taskpriority="0" logused="492" waitresource="KEY: 202:72057594178240512 (da00f8bc7ead)" waittime="7718" ownerId="593536835" transactionname="user_transaction" lasttranstarted="2012-05-02T10:52:00.933" XDES="0x2732a89a0" lockMode="U" schedulerid="10" kpid="1320" status="suspended" spid="257" sbid="0" ecid="0" priority="0" transcount="2" lastbatchstarted="2012-05-02T10:52:24.810" lastbatchcompleted="2012-05-02T10:52:24.763" clientapp=".Net SqlClient Data Provider" hostname="WAFFFAPARAPP10" hostpid="2328" loginname="PAN" isolationlevel="read committed (2)" xactid="593536835" currentdb="202" lockTimeout="4294967295" clientoption1="671088928" clientoption2="128056">
    <executionStack>
     <frame procname="adhoc" line="1" stmtstart="864" sqlhandle="0x02000000a9f8ba394e9a78b74f96de323de665be8b852ba0">
UPDATE [Customers_PHMD_Interests] set [Registered_Date] = @1,[Lead_Source] = @2,[Region] = @3,[MPC_Community] = @4,[Neighborhood] = @5,[Preferred_State] = @6,[Comments] = @7,[PhoneNumber] = @8,[AddressLine1] = @9,[City] = @10,[State] = @11,[ZipCode] = @12,[LicenceNo] = @13,[Builder] = @14,[PlanName] = @15,[PriceRange] = @16,[PreferredMarket] = @17,[BestContact] = @18,[HowHeard] = @19,[TimeFrame] = @20,[PANCorporate] = @21,[Updt_User_ID] = @22,[Updt_DateTime] = getdate(),[Uptd_Prgm] = @23,[PreferredProperty] = @24  WHERE [InterestList_ID]=@25     </frame>
     <frame procname="adhoc" line="1" sqlhandle="0x02000000b473341f9dc1daf9ca9f9ec70cf55b8ffe91d529">
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;5/1/2012 10:36:05 AM&apos;, Lead_Source = &apos;PANHomesQuickReg&apos;, Region = &apos;10&apos;,  MPC_Community = &apos;30&apos;,  Neighborhood = &apos;93&apos;,  Preferred_State = &apos;&apos;, Comments = &apos;&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;92130&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;&apos;,  PriceRange = &apos;&apos;, PreferredMarket = &apos;&apos;,BestContact = &apos;&apos;, HowHeard = &apos;&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;&apos; WHERE  InterestList_ID = &apos;PHQR_2253&apos;    </frame>
    </executionStack>
    <inputbuf>
UPDATE Customers_PHMD_Interests SET Registered_Date = &apos;5/1/2012 10:36:05 AM&apos;, Lead_Source = &apos;PANHomesQuickReg&apos;, Region = &apos;10&apos;,  MPC_Community = &apos;30&apos;,  Neighborhood = &apos;93&apos;,  Preferred_State = &apos;&apos;, Comments = &apos;&apos;,  PhoneNumber = &apos;&apos;, AddressLine1 = &apos;92130&apos;, City = &apos;&apos;, State = &apos;&apos;,  ZipCode = &apos;&apos;, LicenceNo = &apos;&apos;, Builder = &apos;PAN&apos;, PlanName = &apos;&apos;,  PriceRange = &apos;&apos;, PreferredMarket = &apos;&apos;,BestContact = &apos;&apos;, HowHeard = &apos;&apos;,  TimeFrame = &apos;&apos;, PANCorporate = &apos;&apos;,  Updt_User_ID = 1, Updt_DateTime = getdate(), Uptd_Prgm =  &apos;PHMDIntegration&apos;, PreferredProperty = &apos;&apos; WHERE  InterestList_ID = &apos;PHQR_2253&apos;   </inputbuf>
   </process>
  </process-list>
  <resource-list>
   <keylock hobtid="72057594178240512" dbid="202" objectname="AST_CRM_DEV.dbo.Customers_PHMD_Interests" indexname="PK_Customers_Interests" id="lock802a7300" mode="X" associatedObjectId="72057594178240512">
    <owner-list>
     <owner id="process6b652e8" mode="X"/>
    </owner-list>
    <waiter-list>
     <waiter id="process5f23198" mode="U" requestType="wait"/>
     <waiter id="process52e1828" mode="U" requestType="wait"/>
    </waiter-list>
   </keylock>
   <keylock hobtid="72057594178240512" dbid="202" objectname="AST_CRM_DEV.dbo.Customers_PHMD_Interests" indexname="PK_Customers_Interests" id="lock90291680" mode="X" associatedObjectId="72057594178240512">
    <owner-list>
     <owner id="process52e1828" mode="X"/>
    </owner-list>
    <waiter-list>
     <waiter id="process5f3f438" mode="U" requestType="wait"/>
     <waiter id="process6b652e8" mode="U" requestType="wait"/>
    </waiter-list>
   </keylock>
  </resource-list>
 </deadlock>
</deadlock-list>

Thanks in advance,

Anup


Anup | Database Consultant

Blog: www.sqlsailor.com Twitter: Follow me !

Please use Mark as Answer if my post solved your problem and useVote As Helpful if a post was useful.


fixing orphaned users

$
0
0

I know there is a sp_change_user_login stored procedure to fix a user which doesn't have a mother login.

is there any option to run it for all orphaned users?

also after a database refresh, it could be that users could be aligned to the wrong login - due to syslogins and sysusers being out of sync. so is this an issue with mssql and what is the fix for this?

I come from a Sybase background and in Sybase, normally when we refresh a database, from the target database we take bcp of sysusers and sysalternates and after the database restore, we delete the new sysusers/sysalternates and bcp the old sysusers/sysalternates back in. is this fix used in mssql and is that a possibility to fix orphaned users?

appreciate the insights.

Can not access network share using sql agent jobs

$
0
0
Am trying to access the network share using the batch file in Sql agent jobs, my command is

net use j: /Delete &  net use J: \\server_name\Share_name <Password> <Domain/username> /persistent:Yes

I can sucessfully run the above batch file when I run it mannully as administrator, when I include in a job it get sucess but connection not established. am getting the below message,

Executed as user: XXX . C:\Windows\system32>net use j: /Delete   & net use J: \\server_name\Share_name <Password> <Domain/username> /persistent:Yes  The network connection could not be found.    More help is available by typing NET HELPMSG 2250.The command completed successfully.  Process Exit Code 0.  The step succeeded.

Please help me to resolve the issue


Best Regards Moug

How to find blocking processes by using profiler

$
0
0

Hi Experts,

How to identify blocking by using profiler. Please share  step by step process of profiler trace for blocking in sqlserver2000.

Please share resolution also..

Thanks in advance


kerberos authentication understanding

$
0
0

Hi,

Could someone explain brief about this kerboros.

What is Kerberos authentication in SQL Server? Why do we need kerberos?
I have seen setups failing because of kerberos? How do we enable kerberos for sql server ?
I get so confused between kerboros like double hops(delagation) in linked servers and spns issues during sql server 2008 setup failures? Sometimes i do see login failures with 'null' and someone tells it is a kerberos issue.


Thanks in advance.

transaction log backups

$
0
0

so with a database set to full recovery mode, in production environments is a transaction backup job normally run at frequent intervals to keep the log cleared?

because if such a job is setup, it reduces the chance for a database log to go full - unless a single transaction or multiple transactions run simultaneously fill up the log.

appreciate the feedback.

How to get a new year+5 end date from a given date

$
0
0

Hi

I have one more thing like I have to get one more date from this.

The year should be added with 5 but the month and date are fixed (31\12)

example1:

if input date is 01\10\2014

output-31\12\2019

example2:

if input date is 15\04\2010

output-31\12\2015


Thanks, Subrat Kumar

Cant browse below root of mount point in cluster when trying to restore database

$
0
0

Howdy

Running SQL 2008 R2 SP1 cluster on Windows 2008 R2 server.

I have 8 instances of SQL running.

Trying to browse below a mount point to select a file to restore a database, but I cant browse the directory structure below the root of most of the mount points, but I can browse the dir tree under the RecycleBin, MSDTC, System Volume Information mount points.

I have checked the security on all the other mount points for all the other instances, and its identical. On the other 7 instances I can browse dir treet & restore fine.

I do have a work aorund if I put in the full path to the directory and the file name and it will find it and restore fine.

All the clutser resources & dependencies are fine. SQL runs fine, the disks fail over & back fine.

I have checked the privs for the account running SQL and its the same as we use for the other instances.

Thoughts welcome - its got me baffled. 

Thanks in advance.


Temp DB space issue

$
0
0

Hello

I have two instances fo SQL Server ruuning in a test enviornment with totally 60 GB. Both has multiple  files and inital size is 2GB per file. But the OS shows only 2.5 GB free space left. So when i ran the below query and looks like temp DB is not using that much space, then why ony 2.5 GB free on that drive. If any one can explain that will be great!!!!

SELECT SUM(unallocated_extent_page_count) AS [free pages],
(SUM(unallocated_extent_page_count)*1.0/128) AS [free space in MB]
FROM sys.dm_db_file_space_usage;

free pages      free space in MB
2085600        16293.750000 

free pages      free space in MB
3587672        28028.687500

Thank you!!!

 

Database snapshot - usage of CPU

$
0
0
Hi,
I have a db and a snapshot for this db.
I notice that the CPU time when a query is executed on snapshot is 8 times, in my case, greater than if the same query is executed on the original db.
My question is: this behavior it's normal ? If I want to move my reports on the snapshot, the CPU used by SQL Server will increase ? 
The SQL Server has a 'maximum server memory', so, is possible that the other processes to be hampered ?
Thank you


Msg 1088, Level 16, State 9, Line 1 Cannot find the object "sys.syscommittab" because it does not exist or you do not have permissions.

$
0
0

When I am rebuilding indexes/defrag on our production database. SQL serve is throwing below error. It's SQL Server 2008 EE. 

Any idea what could be causing this error?

Msg 1088, Level 16, State 9, Line 1

Cannot find the object "sys.syscommittab" because it does not exist or you do not have permissions.

Thanks,

Sree

SQL Server optimizer not using NOT NULL computed columns defined in index.

$
0
0

The optimizer will never choose to use [From] (or [To]) in this example, despite the direct reference. It will always scan the entire table via the index in order to return all of the component parts of [From] and [To] in order to answer the query.

(The optimization plan for the select at the end is the same whether there is data in the tables or not)

  • There is no point in having a computed column stored in an index if the optimizer is incapable of using it
  • The computed columns in question can never be NULL, in either table

In my real case, it is simply not physically possible to store every component of every computed column in the index, and even were it possible, it just seems wrong.

  1. Is this the intended functionality, or is it broken?
  2. Are there any obvious ways of fixing this (before you answer, think tens of billions of rows)?

CREATE TABLE [dbo].[T_optimizer_test](
    [rid] bigint identity (1,1) NOT NULL,
    [doy] smallint NOT NULL,
    [source] int NOT NULL,
    [cc] varchar (3) NOT NULL,
    [sec1_From] char(3) NOT NULL,
    [sec1_To]  char(3) NOT NULL,
    [sec2_To]  char(3) NULL,
    [sec3_To]  char(3) NULL,
    [From]  AS [sec1_From],
    [To]  AS coalesce ([sec3_To],[sec2_To],[sec1_To]),
 CONSTRAINT [PK_optimizer_test] PRIMARY KEY CLUSTERED
(
    [rid] ASC,
    [doy] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, DATA_COMPRESSION = PAGE) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO

SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET NUMERIC_ROUNDABORT OFF

GO

CREATE NONCLUSTERED INDEX [idx] ON [dbo].[T_optimizer_test]
(
    [From] ASC,
    [To] ASC,
    [source] ASC
)
INCLUDE ([cc]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100, DATA_COMPRESSION = PAGE) ON [PRIMARY]
GO

create table #TEST ([From] char(3) not null,
                    [To] char (3) not null,
                    [source] int not null)
GO

select t.*
  from [dbo].[T_optimizer_test] x,
       #TEST t
 where x.[From] = t.[From]
   and x.[To] = t.[To]
   and x.[source] = t.[source]

user defined filegroups

$
0
0

can I know how you guys use user defined filegroups in your particular jobs?

in the sense, do you use it to store particular types of objects in a database - like say indexes or large tables etc.

whatever reason you cite, I would also like to understand the why and how. so pls try to elaborate.

just trying to get an idea of the various ways in which user defined filegroups are used practically in real work environments.

appreciate the insights.



Peformance - IO and virtual file stats

$
0
0

I was looking at this article : https://www.simple-talk.com/sql/performance/a-performance-troubleshooting-methodology-for-sql-server/

under the 'Virtual File Statistics', the author makes several points which I found difficult to understand. appreciate any clarification :

>If the data and log files are on a shared disk array in the server, and the calculatedavg_total_latency is >the same across all of the databases, and higher than what is acceptable for the specific workload, then the >problem may be that the workload has outgrown the disk I/O subsystem.

how do we define what is 'acceptable for the specific workload'?

is there any prior/historical statistics that we can avail of for the above?

also does "the workload has outgrown the disk I/O subsystem" mean the disk space available or disk controllers/spindles etc?

also would not a comparison of data/log files in terms of read, writes, stall etc - point to bad performing individual disks? ie if disk 1 stalled for 10 seconds for 1000 reads and 1000 writes and disk 2 stalled for 30 seconds for the same work load, then would disk 2 be considered poor performing?

appreciate the insights.

Problem Copy big Table sqlserver 2012

$
0
0

Hi Friends,

Its 4th day I am trying to copy  table having 7 million record with text field  into same database (sqlserver 2012)  , but fail although I am using blade server with 256 Gb memory and multiprocessor. My query as followed

select * into newtable from  maintable where flag=0 

(Just while ago   I  canceled above statement (query) which was working since last 14 hours on server)

Please help mean how I can copy.

thank you.

regards,

asad


asad


SQL Server Query Plan Generation take longer

$
0
0

Dear all,

We are dealing with a wired issue where queries on there first execution take approx 1 min to 2 mins to execute and later execution completes in less than a second,Can you please help us understand why sql server is taking longer time to generated the query plan

Below is the result of files stats


Mohd Sufian www.sqlship.wordpress.com Please mark the post as Answered if it helped.

SQL Server configuration

$
0
0

let us suppose you install an instance - brand new instance which is going to go into production sometime later.

next, what are the configuration parameters that you would configure?

like memory etc.

appreciate the feedback.

transaction log backups

$
0
0

so with a database set to full recovery mode, in production environments is a transaction backup job normally run at frequent intervals to keep the log cleared?

because if such a job is setup, it reduces the chance for a database log to go full - unless a single transaction or multiple transactions run simultaneously fill up the log.

appreciate the feedback.

Error on start database engine

$
0
0

i have sql server 2012, but in database engine service i can't start Milad service. and this error come for me

err


Help me PLZ !

Deadlocks

$
0
0

Hi  All,

We are getting the below alerts very frequently these days. Can anyone suggest about this issue and what was the root cause, and how to resolve it. I checked in error log there is no information at that time.

Service: MSSQL Query - Check Master DB for Deadlocks

Host: xyz

Address: 1234

State: CRITICAL

Info: CRITICAL: Query expected 0 but got 1. Date/Time: 10/10/2014 15:57:25

Thanks in advance...





Viewing all 12963 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>