Tag: performance

How to capture actual execution plan in a deadlock graph?

Is there any option or any setting by which SQL Server can dump the actual execution plan (at that instance) for stored procs involved in a deadlock? This is in context of SQL Server 2008.

PHP + MSSQL ON IIS is Extremely Slow

I have a problem while trying to connect to local MS SQL server using PHP on IIS . the mssql_connect takes 2-3 seconds to execute and it slows down the page execution , the same also with persistent connection using mssql_pconnect . i tried the same page with Apache on the same machine it execute […]

Performance Impact of creating a view to a Linked SQL Server

I have a database where I would like to create a view from a linked SQL Server. Are there performance hits even though this is a view, and are there any maintainability of scalability issues, or something else negative about this approach? I don’t want to duplicate data across databases.

EF 4.1 code-first: difference between EF generated sql and custom sql

I have a question about sql generated by Entity Framework and the hand-writed one. In my project, I have some entities (they aren’t important really for this Q), for a simple example, when I use this code: var query = context.Employees.Select(e => new { PersonalCode = e.PersonelCode, Fname = e.Person.Fname, Family = e.Person.Family, Email = […]

strip html – Whos job is it?

In db I have : (have = existing situation. the DB has already has the data) Long html string (nvarchar max) user have : asp.net aspx page mission: extract from the whole html string 1 specific sentence – and show it to user options : 1) do the strip job in sql and transfer the […]

SQL Server: Joining by primary key or using separate queries?

I have a simple question regarding the dichotomy of joining two tables vs using 2 separate queries. I was hoping to find an existing question, but my search didn’t yield much (most questions were for more complex problems). For example, consider two tables, A and X, with a very simple schema: Table A +————-+————-+————-+ | […]

Select performance

Is it fair to say that it takes no time (compared to the nested SELECT) to make the second (outer) ‘SELECT’ from a result-set like this? SELECT some_column FROM ( SELECT some_column FROM some_table ) AS _alias

Should my view be much slower than my stored proc?

I have a view that I can’t seem to fully tune, so I tried converting it to a proc, moving one of my WHERE conditions that I use when querying into a parameter and using the parameter in my derived tables. View CREATE VIEW myView AS SELECT i.ItemCode , s.StoreID , ISNULL(SUM(s.TotalSales)) AS Sales FROM […]

Calculate COUNT in GROUP BY SQL query

I have query to calculate total amount by one product item below: SELECT p.[Id], COUNT(o.[Id]), SUM(o.[Amount]) FROM [dbo].[Order] o INNER JOIN [dbo].[Product] p ON p.[Id] = o.[ProductId] GROUP BY p.[Id] In this case, COUNT(o.[Id]) is number of unique orders by one product item. But instead of COUNT(o.[Id]) I would like to calculate number of orders […]

Subquery in view runs slow

Hello i have an issue with my view. The Subquery causes the view to run very slowly. SELECT dbo.Calls.CallID ,dbo.Calls.StartTime ,dbo.Calls.EndTime ,dbo.Connections.Connectionname ,dbo.Repositorys.RepositoryName ,REPLACE(dbo.Calls.Querytime ,’,’ ,’.’) AS Querytijd ,dbo.Calls.Uur ,dbo.Calls.DayOfMonth ,REPLACE( ( SELECT MAX(Querytime) AS MaxQueryTime FROM dbo.Calls AS C WHERE ( DATEPART(yyyy ,StartTime)=DATEPART(yyyy ,dbo.Calls.StartTime) ) AND (DATEPART(M ,StartTime)=DATEPART(M,dbo.Calls.StartTime)) AND (DayOfMonth=dbo.Calls.DayOfMonth) AND (Uur=dbo.Calls.Uur) AND ( […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.