.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

CAST in delete query-Performance is so slow

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :Sql Server
Hi all, I've below join in the delete statementt, but it's taking so long the query run, the performance is really bad because of cast conversion, is there a better way, especially performace wise to fasten this below join, A.PHONE in nvarchar data type and DNC.PHONE_NUMBER  is in bigint data type.   A.PHONE=CAST(DNC.PHONE_NUMBER as varchar (15)) Thank you.

View Complete Post

More Related Resource Links

Very slow performance with a query involving JOINS

I am experiencing extremely slow performance on a particular SQL query using SQL compact.  This same query completes in less than one second on my regular SQL server.  With SQL compact, I am actually not even sure if the query ever completes.  As I type this I am testing it from SQL management studio, and it's up to 17 minutes and 40 seconds still executing so far. Since I am not experiencing this on most of my other queries, I have little doubt the slowness is due to the volume of data in these tables, coupled with the fact that I am doing the joins.  I made sure that foreign key constraints are in place for the columns that the joins are based on.  From what I've read, this also ensures that appropriate indexes are created, although I am starting to wonder about that. This is the query: SELECT TOP (200) t.BusinessEntityID, t.BusinessName, t.IsTowTruck, t.IsHospital, t.TowTruckLastUsed, t.BusinessLocked, cn.Address1, cn.City, cn.State, cn.PostalCode, cnp.PhoneNumber as TopPhoneNo, GetDate() as LastUpdatedDate, GetDate() as CreatedDate FROM tblBusinessEntity t LEFT JOIN cnBusinessEntityLocation cn ON cn.cnID in (SELECT TOP (1) cnID FROM cnBusinessEntityLocation where cnBusinessEntityLocation.Active = 1 AND cnBusinessEntityLocation.BusinessEntityID = t.BusinessEntityID

MDX query performance is slow for complex logic implementation in Calculated Members.

We have implemented a calculated members which involves multiple calculated members  called in a nested e.q. Cal1 calls Cal2 and Cal2 calls  Cal3  and Cal3 calls Cal4 .  And when browing Cal1 through Excel it takes around 30 mins for getting result from a Partition having row count around 5 million. Follwing are the information on the scenario I am having: We are having partitioning in the cube. one partition contains around 4-6 million records Processers on Query Server: 4 quad core RAM on the Query Server: 64 GB Calculated members having simple calculation logics are giving results in no time. There is a Calculated members which calls 6 intermediate calculated in nested way and with small Data Set like 5-6 k rows it is running fine.   Any help will be much appreciated.   Regards, Sandeep

Slow query performance after upgrading from SQL2000

Slow query performance after upgrading from SQL2000

We are having query performance issues with our data warehouse server after upgrading from SQL2000 to SQL2008R2.

Our problem is that *some* queries which ran in 5 seconds in SQL2000 now take 11 hours in SQL2008R2.

Worth noting that we get the same problem in SQL2005.

The queries which are stalling usually involve subselects. Some of those queries can be rewritten to remove the subselect but other queries are **dynamically** generated by an application which can not be changed.

We have tried altering the following server settings:

- Max worker thread (0 or 256)
- Degree of parallelism (0 , 1 or 4)
- Max memory (Reserve 1GB memory for system)
- Cost threshold (for parallelism) 1,5 or 20

Some of the other things We have tried:

- Adding new indexes
- Update statistics
- Rebuilt all indexes
- Migrating original data into new tables

SQL2000 and SQL2005 instances: 4CPU, 4GB RAM, Windows Server 2000 SP4
SQL2008R2: 4 vitual CPU cores, 6GB RAM, Window

performance issue - slow query


Hi  - I have a query which is running very slow under a certain condition. I have 2 tables, Employees and EmployeeGroups. Employee has employees personal information and employeegroups has a mapping of each employee to the group it belongs to. One employee can be a part of multiple groups. The problem is with the below query.

SELECT emp_GUID, emp_firstname,emp_LastName
FROM Employee E join EmployeeGroups ON Emp_Guid=EMG_Emp_GUID
where EMG_GUID In ('multiple group GUIDs') and emp_Lastname like 'abc%'

EMG_Emp_GUID - Employee id of the employee

EMG_GUID - ID of the group employee belongs to.

The query runs well with less number of groups but it slows down as the number of groups i.e data increases. The tables is well indexed.

I am running out of ideas on this. Need help.

Cheers!!! SqlFrenzy

Basic Instincts: Increase LINQ Query Performance


Jared Parsons demonstrates a technique to achieve maximum performance from LINQ queries on large sets of data in order to create a responsive user interface.

Jared Parsons

MSDN Magazine August 2008

Slow page load during a list query one time during the day


We have a monitoring tool set to check to see if the home pages for our 3 web apps load in under 60 seconds every 10 minutes.  All 3 web apps load in under 3 seconds on every 10 minute check except for one exception.  One check every day one of the web app's home page takes longer than 60 seconds to load.  This happens at 11:45PM when there is very little user usage on the environment.  The characteristics of this page are as follows: The only thing on the page is a list view web part which was added by the browser.  The page has not been customized with SPD or code at all.  The list that it pulls is a simple links list that has 281 items on it.  The view pulls all 281 items and displays them in sets of 100.  I cannot find any associated event in the server events and/or SharePoint ULS logs nor are there any daily sharepoint timer jobs running at that time.  Our full index happens at midnight with incremental happening hourly.  Our enviroment is 2 WFEs, 1 App/indexer and we have a separate SQL cluster backend.  

Could someone lead me possibly in the direction I should take next in my troubleshooting?   

FAST search query is slow...

Hi, we are using fast search for sharepoint 2010. We are crawling an external data source and this is used for search queries. we have around 30 metadata properties and all are full-text indexed. however, the search operation is slow for a database of 5k records in intranet (webserver and database server are in different geographic regions). typically a 100 item search takes 9-10 sec. it get worse over internet and the search query varies from 10-45 sec for 100 items. Any pointers will be helpful. thanks.  

Query Performance & Overall Design - SSAS MDX WCF

Hi All, We have a Cube which is to be queried by the Online system , using WCF service. Peroformance of the queries running on the Cube is not really very good , as we have to calculate various percentile (which are all calculated members) on the cube, this howver works well within limits of 5-6 secs for small sample size. But this goes beyond the threshold of 30 secs when the record counts increases. What we have is our SSAS Cubes , and we have WCF Service querying the Cube using ADOMD.NET. This may not be one of the best way to achieve this requirement , but we are kind of completed with development and it may not be feasible to work on another approach, what we are looking for is optimize this design and make it work with in expected time limits of 5-8 secs. Kindly let me know, if i am not clear or if you need any more info to suggest something ! Thanks a lot for your help !   Kindly

Slow query execution

Hello, I have a strange problem that suddenly happened. I have a Windows 7 Ultimate OS running SSMS 2008. When I run a query or an stored proc against a server (the server is remote and passes through a VPN tunnel) it can take me 40 seconds to get the query to complete. But when I run a similar query against another server located at the same location (go through the same tunnel) I get the results in 1 second.  I select about 400 rows on both servers. The slow response comes from a server that runs sql 2005 and the fast response is sql 2008. I asked a friend that works in the same office with me and uses the same connection as I do to run the same queries and he gets the result in 1 second. Does anyone has any ideas what can cause such problems?  I tried to remove and reinstall all the sql server components from my computer but nothing helped? Thanks, Oded Tal

Oracle Linked serve Query performance in 2000 vs 2008 R2 64 Bit

Hi everyone We have started to migrate one of our reporting systems from Sql 2000 to Sql 2008 R2.  One of the steps has been to test the perforance of certain Oracle linked server queries between each server.  We are finding on average 3 fold better perforance stats (in terms of query completion time) on the old server.  This should obviously not be the case.  The new server has signifantly more CPU/Memory/IO resources to play with, and it is 64 bit (not to mention its new!).  Here's what I got so far: Old server: SQL 2000 on W2000 both fully patched.  Old Dell Dual core with 3 GB of Ram running on two soft IDE Mirrored drives (yes I know... it sucks).  It connecting via the MS OLE DB provider for Oracle (9i client) New server: ESX VMware Server with 2 CPU's assigned, 8 GB of ram connected to large HP SAN.  CPU, ram and IO's have all been ruled out as the problem.  We've tried varying network cards with different results so we havent ruled that out yet.  Its connecting via the Oracle provider for OLE DB (11G 64 bit client) The linked server is an Oracle 9i fully patched server.  All three are on the same network backbone. Running a simple select * query on both servers returns the same number of rows (~76 000) .  It takes ~1:20 on the new server and ~0:20 on the old server. In looking at the wait stati

Very Slow Performance on 64 bit SQL System

Hello, we have a Windows Server 2008 64 bit and a SQL Server 2008 64 bit. The server work and the speed with a quad CPU and 8 GB RAM is nice. But, we use a SQL script with xml (we make a XML paket for replication) is the speed very slow. The script need 40 - 60 min to finish. But the same Database and the same script on a Server 2008 32 bit and SQL Server 2008 32 bit on the same hardware need 22 seconds. We have all updates installed. Have anywere a Idea? Thank

Full text performance of a certain query

I am doing a full text query on a very simple table and when I include the search term "y5v" in the conditions it slows the query down like 8 to 1. The table is defined as: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[tblTextSrchData]( [intItemId] [int] NOT NULL, [srchTxt] [varchar](max) NOT NULL, CONSTRAINT [PK_tblTextSrchData] PRIMARY KEY CLUSTERED ( [intItemId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] Here is the query: SELECT II.intItemID, KEY_TBL.[RANK] as Score FROM tblItems II INNER JOIN CONTAINSTABLE(dbo.tblTextSrchData,srchTxt, '("capacitor" OR FORMSOF(INFLECTIONAL, "capacitor") OR "capacitor*") AND ("active" OR FORMSOF(INFLECTIONAL, "active") OR "active*") AND ("y5v" OR FORMSOF(INFLECTIONAL, "y5v") OR "y5v*")') KEY_TBL ON KEY_TBL.[KEY] = II.intItemID If I take any of the additional search terms out it improves performance.  If I remove the yv5 search term the results are returned in less than a second. What seems to be the problem is for some reason when I add yv5 it starts doing these sorts after the full text matching.  These sorts take most of the time.  I'm not sure

MDX query using linked server - performance question

Hi, I'm having a strange performance behavior. When I’m running a mdx query on management studio, it runs for 10 minutes (its mainly calc members on a large cube) When I run the same query via linked server and openquery, it runs for 20 minutes. Is the SQL from some reason does a parsing or running the query twice? The server is sql2008 UP1 on 64bit. and the "allow in process" is checked. its the default in sql2008 Thanks in advance, Yoav  

BIDS Query Designer very slow in VS 2008

I am in the process of upgrading my Report Server projects from 2005 to 2008.  These reports use an Analysis Services 2005 data source and have queries that are anywhere from 20 to 100 lines of MDX.  After upgrading a report, when I open or save a dataset in the Query Designer, it takes up to 20 seconds.  In 2005, this would happen almost instantly. Running SQL Server Profiler, I see that there is an extensive number (600+) of Discover events going on with the Analysis Services server while the Query Designer loads. My version of Visual Studio is 9.0.30729.1 SP and I am running Windows XP SP2. Thanks, Mitch

BIDS Query Designer very slow

BIDS Query Designer seems to be very slow while saving the query or opening the query designer when you've got quite a lot of Query Parameters. When I remove all the query parameters, the query designer seems to be running smoothly. Editing a query with about 10 to 15 query parameters takes ages this way! Is there something I can do about this?!

query w.r.t to SharePoint 2010 Performance Planning & Extranet Topology

  1.      Which extranet topology to go with in case of exposing Intranet to Remote Employees / Partners ?   My understanding:   There are 3 extranet topologies : Edge Firewall , Back to Back , Split back to back   If Scenario is : a)      Only Employees needs to access Intranet from Home ,we can go for Edge Firewall b)      If partners & Employees , both needs to access Intranet ( it will have some partner sites ) , then we can go for Back to Back OR Split back to back .   Questions: ·         Is Understanding correct ? ·         Is there any factor which can help in making a decision between Back to Back Or Split back to back ?   2.      As part of sizing , I read that we should capture following information -          What should be maximum acceptable CPU utilization in production servers ? ( Example : 70%) -          What will be the concurrent number of users accessing portal during peak hour of a day ? ( Example 1000 users from total of 18000 users ) -          How many request per second are done to portal

Slow performance when searching in "any part of field" of a SQL Server database using a Microsoft Ac

We have just migrated our back end database from Access to MS SQL Server 2008 R2. We have noticed better performance on our searches - unless we select to search in "any part of field" in Access (with Access' built-in search function - we use a mix of Access 2003 and 2007). This takes nearly 20 seconds to find the result, whereas before the migration it was taking 5-7 seconds (compared to instant results we now experience when searching for whole fields). The main fields we search are not large - usually just two words. Obviously it is better to search for a whole or start of a field, but this is not always possible. The contractor that assisted us in this project has told us that this "is just the way SQL works with Access". Is this really true? I find it hard to believe two MS products would have such a big issue between them. I presumed using SQL with an Access front end would be a common setup, which is why I thought this must be a problem with our setup. Is there any way to fix this speed issue?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend