Tag Info

New answers tagged

7

is it possible to view the locks, along with the type, acquired during the execution of a query? Yes, for determining locks, You can use beta_lockinfo by Erland Sommarskog beta_lockinfo is a stored procedure that provides information about processes and the locks they hold as well their active transactions. beta_lockinfo is designed to gather as ...


2

Here is how I look at locks by process/table/lock type: SELECT HostName, "OS UserName", Login, spid, "Database", TableID, "Table Name_________", IndID, -- [Index Name], "Lock Type", "Lock Mode", Status, -- Resource, Count(*) AS "Lock Count" FROM ( SELECT Convert(VarChar(30), ...


0

Yes you can view the locks and its type during the query execution via Adam mechanics's SP_whoisactive click here to view Moreover if you want to create a block report with you can do with help of trace as explained here


1

You can view the locks for a session using sp_lock or sys.dm_tran_locks. In both ways you can filter by the session. You can also use Extended Events to do that.


0

When running the execution plan, I noticed that each one of the 5 or so queries that are parsing the filter data are costing about 12% which is over 60% of the query just to determine the data we are going to be filtering by. The query costs are based on estimates even in the actual execution plans. They do not tell you how efficient the query ...


0

Folks, I was able to resolve the issue by updating the statistics . I believe it is related to outdated stats and so the query optimizer getting not so efficient execution plan. Thanks


1

Fisrt optimizer takes one of best plans - not the best. This is because when the optimizer works the time for calculating the best plan can be bigger than the time it saves during the execution. And yes, optimizer works based on statistics. So if your statistics is old enough optimizer will create plan suiatble for that statistics - i.e. for the moment of ...


4

The optimizer strives to get a plan that is "good enough", and this is not always the optimal one. A very common reason is a too complex query. Breaking it down to a few queries helps the optimizer choose a better plan. In some cases, too many indexes on a table can also cause this, as the optimizer might use an index that is not the best one because as ...


5

1. How to understand estimated operator cost? Tb1 which don't have index is scanned and cost is 2 %, whereas index is being used on tb2 and cost is 98%. The heap table is only fully scanned once, but the index seek is executed 1,000,000 times. The optimizer estimates that a million seeks in this case will represent 98.4% of the total cost of executing ...


3

The CONVERT_IMPLICIT is occurring because you have a collation on the column which does not match the parameter's collation. So the parameter is converted to the column's collation. To explain further - there are collation coercion rules which triggers this conversion. So if you have an implicit collation for the column and a coercible-default for the ...


5

It was all down to collation of the column. It was different from the database's (and the table's) collation. Now changed the column's collation to database's and no more implicit conversion shows up. Have no idea about the internals and why it caused the problem.



Top 50 recent answers are included