Query Performance Comparision

Jan 19, 2000

How could I tell the performance difference between two queries:

One is:
select * from table
where Lower(colomnname) = 'value'

The other is:
select * from table
where colomnname = 'value'

Basically the difference is in lower() function, how much this function will affect the query performance.
Is there a formal way to test it out, or by any logic.
Thanks, Mike

View 2 Replies


ADVERTISEMENT

Performance Comparision Of Different Connection Types

Apr 2, 2006

Do you know some performance differences between reading data from a stored procedure using:

1. OLE DB Connection and OLE DB Source

2. ADO.NET Connection and DatareaderSource

Przemo

View 1 Replies View Related

Performance Comparision - Stored Procedures VS SQL (Inside SSIS)

Mar 23, 2007

I am working on a technical design of data integration ETL package which will be moving data from SQL Server Source to DB2 destination. I currently have two options, when moving data to DB2(IBM AS400). I can call a AS400 Stored Procedure, and pass in the data to the stored procedure, and perform the insert processing within the AS400 environment or I could do inserts from SSIS in a DFT and write individually to AS400 tables. My question is from a performance and good practice perspective, which method should I move forward with. I need a possible list of pros- and cons when using AS400 Sproc vs using SQL within SSIS? I would really appreciate response from individuals who have done something similar in the past. Thanks a lot and I am really looking forward to responses.

View 1 Replies View Related

Extremely Poor Query Performance - Identical DBs Different Performance

Jun 23, 2006

Hello Everyone,I have a very complex performance issue with our production database.Here's the scenario. We have a production webserver server and adevelopment web server. Both are running SQL Server 2000.I encounted various performance issues with the production server with aparticular query. It would take approximately 22 seconds to return 100rows, thats about 0.22 seconds per row. Note: I ran the query in singleuser mode. So I tested the query on the Development server by taking abackup (.dmp) of the database and moving it onto the dev server. I ranthe same query and found that it ran in less than a second.I took a look at the query execution plan and I found that they we'rethe exact same in both cases.Then I took a look at the various index's, and again I found nodifferences in the table indices.If both databases are identical, I'm assumeing that the issue is relatedto some external hardware issue like: disk space, memory etc. Or couldit be OS software related issues, like service packs, SQL Serverconfiguations etc.Here's what I've done to rule out some obvious hardware issues on theprod server:1. Moved all extraneous files to a secondary harddrive to free up spaceon the primary harddrive. There is 55gb's of free space on the disk.2. Applied SQL Server SP4 service packs3. Defragmented the primary harddrive4. Applied all Windows Server 2003 updatesHere is the prod servers system specs:2x Intel Xeon 2.67GHZTotal Physical Memory 2GB, Available Physical Memory 815MBWindows Server 2003 SE /w SP1Here is the dev serers system specs:2x Intel Xeon 2.80GHz2GB DDR2-SDRAMWindows Server 2003 SE /w SP1I'm not sure what else to do, the query performance is an order ofmagnitude difference and I can't explain it. To me its is a hardware oroperating system related issue.Any Ideas would help me greatly!Thanks,Brian T*** Sent via Developersdex http://www.developersdex.com ***

View 2 Replies View Related

Table Comparision

Aug 15, 2000

I need to compare two tables and output everything that doesn't match.
The tables are joined by the "domainname" column, and I need to output everything in both tables where the "domainname" doesn't match.
Any ideas?

View 3 Replies View Related

Date Comparision

May 3, 2008

I am using SQL Server 2005 Express Edition. One table contains field docdate having format dd/MM/yyyy hh:mm:yyyy. Here hours & mins are also required.

I am working on VB6.0. User will input date on form in format 'dd/MM/yyyy'. I just want to check this with SQL Server date considering only dd/MM/yyyy.

How to do this?

View 2 Replies View Related

Database Comparision

Dec 22, 2006

Language : VB.NET
Database : MSSQLserver2000
i have developed a tool to compare two databases, but it is taking long time to compare. First it will take the whole table into main memory(order by primary key). Same procedure for table2 of second database. Then it will start comparison by taking row by row. i tested with one third party tool, which is taking only 2 min to compare 800000 records of a table. My tool is taking 1 hour,40 mins to do that. Is there any other optimized method?


Regards,

Loka

View 4 Replies View Related

Tools For Db Structures Comparision

Jul 10, 2002

Hi,Does any of u folks used any tools for database structures comparision??

I have used DBDIFF(from DKGAS.com) ChangeManager from Embarcadaro and SQL COMPARE from Redgate.

I did have have some problem in each of these tools AND am looking for some good tools which are economical also.

Thx in advance
Ravi

View 2 Replies View Related

Table Schema Comparision

Jun 12, 2006

Hi Gurus,

I am looking for a script which lists me the differences between two table schemas.

Thanks in advance

Srini

View 3 Replies View Related

Comparision Of Sql Server && Mysql

May 19, 2006

whats the difference betwwen mysql and sql server2000 in terms of usingstoredprocedures,stored functions and views.

View 3 Replies View Related

Database Object Comparision Script

Feb 6, 2004

does any one have a script.. to compare objects(tables, views, sps, func etc) between two different databases.


thanks

View 5 Replies View Related

Developer Edition Feature Comparision

Jan 31, 2007

I am trying to compare developer edition and Express edition. I almost purchased the developer edition and wanted to compare it with other editions. no info to be found. Would greatly appreciate it, if someone could direct me to a resourse that shows this comparision.

thanks

ps.The product comparision page doesnt show developer edition.

View 1 Replies View Related

Case Sensitive String Comparision ??

May 2, 2008

Dear all,

I have building an authitication mecanism through a database standard login table as :

UserName varchar
PassWord varchar
UserId Identity

From my client application I need to validate the username and the password.
For that I have a store procedure with the following statement :


SELECT @loginID = Id from [NomosConfig].[dbo].Users

WHERE [UserName]=@UserName

AND [PassWord] = @pw

From that point this works well except that for the passowrd, whre of course there will be no difference between:

PassWor = myPassw or MYPASSW

How can I check in password field in order that it is case sensitive....?

Later on, the password will be encrypted of course, will it behaves similar ?

thnaks for help
regards
serge

View 6 Replies View Related

Comparision Of SSRS With Crystal Reports

Apr 23, 2008


1) Crystal Reports provides extensive parameter support. The types of parameters supported are: single value, multi-value, and range value (e.g. Start date to End date), or a combination of all three.
2) SSRS parameters only support entry of a single value. It doesn't support multi-value parameters or range parameters. For example, the user can't be presented with a list of Employees and select more than one for reporting on. Doing so requires writing custom code and writing more complex SQL queries

View 5 Replies View Related

Update SQL Column With Comparision Between Last And Current Records

Jun 13, 2006

My question is concerned with the three columns below (customerID, RepairDate, CompletedRepair (Yes or No). The column name "CompletedRepair " is blank initially. I need to update the CompletedRepair column with this logic below:

- A customer comes to our store to fix their car, if we fix their problem on the first time and they don’t return later for this same issue, then the
•CompletedRepair column = Y

- If a customer needs to come back to our store to re-fix the same issue within 7 days windows based on the RepairDate on the previous transaction then
•On the last return transaction: CompletedRepair = Y (example: RepairDate =6/12/2006)
•On all previous transactions: CompletedRepair = N (example: RepairDate =6/8/2006, 6/9/2006, 6/10/2006)

- If a customer needs to come back to our store to re-fix the same issue but out of the 7 days windows based on the RepairDate then
•On the last return transaction: CompletedRepair = Y (RepairDate =6/12/2006)
•On the previous transaction: CompletedRepair = Y (RepairDate =6/1/2006)

Every time customer comes to for car repair shop for a new issue or an old issue, we create a new repair transaction in our SQL db. The update on the "CompletedRepair " column will be run every day. Today's records will be run against with last 7 days records (based on Repair Date) to check when customer has been really fixed: the last fix counted Y, the previous fix counted as N but comparison in only 7 days. In other words, a repair today is considered as a completed repair when comparing with last 7 day repairs but it might become not a completed repair if this same customer would come back within next 7 days for the same issue.

The CompletedRepair column is dynamic column and is updated daily by using the logic above.

Below is the expected outcome after we update the Completed Repair column:

CustomerID Repair DateCompleted Repair

ab1 06/12/06 Y
ab1 05/28/06 Y
ab1 05/18/06 Y
ab105/15/06 N
ab1 05/12/06 N

Initially 5/12/06 had Y, when 5/15/06 transaction came, it took the Y and made the 5/12/06 become N. The 5/18/06 transaction did the same to 5/15/06 transaction, made itself Y and converted 5/15/06 into N. The 5/28/06 is Y because comparing with 5/18/06, it is out of 7 days window. The 6/12/2006 is Y because comparing with 5/28/06, it is out of 7 days window.

ab2 06/02/06 Y
ab2 05/28/06 N
ab2 04/19/06 Y
ab2 04/14/06 N

The 4/14/06 transaction initially was Y, it became N when new transaction on 4/19/06 came. Same thing with transactions on 5/28/06 and 6/2/06

ab3 05/11/06 Y
ab3 03/29/06 Y
ab3 03/23/06 N
ab3 03/12/06 Y

The 3/23/06 was Y, when new transaction on 3/29/06 came, it became N and the new transaction is Y. The 5/11/06 is Y because comparing back to 3/29/06, they are out of 7 days window.

ab4 05/11/06 Y

This ab4 customer came to fix her car only one time and don't come back. We supposed the fix was sucessfully and so we mark the CompletedRepair as Y.


I think that I would need to use SQL cursor or case statement for this but I really don't know how to start. Please advice and help me out. Any ideas and suggestion are really appreciated! If you need more information, please let me know!

Thank you!

Tracy

View 4 Replies View Related

How To Do Pair-wise Comparision Like Oracle In MS Sql Server 2000?

Apr 18, 2008



How can we do pair wise comaprission using Sub query as generally can be done in Oracle?


Thanx

View 4 Replies View Related

Comparing Values In Two Tables In Order To Do Insert -- Comparision Is Not Working!!

Jul 23, 2005

I have the following insert statement in place:Insert WPHPayments(constituentID, constituentName, campaignYear, fundID, fundDescription, dateAndTimeEntered, amount)Select gt.constituentID, gt.constituentName, gt.campaignYear, gt.fundID, gt.fundDescription, gt.dateAndTimeEntered, gt.amountFrom GTPROCENTERFUNDPAYMENTEXTRACT gt, WPHExtractWhere gt.constituentID = WPHExtract.wph_constIDI want to insert all of the values that are in the GTPROCENTERFUNDPAYMENTEXTRACT table that have the same constituentID that as the records in the WPHExtract table.  Am I just missing something becasue the syntax is showing that everytihing is correct however there is nothing comming back in the result set.  Thanks in advance everyone.  Regards,RB

View 1 Replies View Related

SQL Query Performance

May 19, 2004

Hi..

Is there any specific place where I can find which SQL Query is more efficient?.

Is INNER JOIN is faster or Select ... Where ID in (SELECT ...) is faster?

I have two tables:
1.FLEET (The number of rows is not so much)
Attributes :
Company_Id (PK)
Fleet_Id (PK)
Fleet_Name
Fleet_Description

2.USER_PRIVILEGE (The number of rows can reach up to 3 times the number of row in fleet table)
Attributes :
Company_Id (PK)
Fleet_Id (PK)
User_Id (PK)
Privilege_Id(PK)
Comment
Category

I want to select Fleet_Id and Fleet_Name from fleet table
Where the current user has privilege_id=1

I have two possible select statement :

1.Option 1

SELECT Fleet_Name, Fleet_Id
FROM FLEET
WHERE (Company_Id = 2) AND (Fleet_Id IN
(SELECT fleet_id
FROM user_privilege
WHERE user_id = 11 AND company_id = 2 AND privilege_id = 1))
ORDER BY Fleet_Name

2.Option 2

SELECT F.Fleet_Name, F.Fleet_Id
FROM USER_PRIVILEGE U INNER JOIN
FLEET F ON U.Fleet_Id = F.Fleet_Id
WHERE (F.Company_Id = 2) AND (U.Privilege_Id = 1) AND (U.User_Id = 11)
ORDER BY F.Fleet_Name

Actually which one is faster. Is SQL Statement with INNER JOIN (Option 2) can be executed faster than the one with double Select Statement(Option 1)?

Any suggestion is welcomed.
Thank you very much.

View 1 Replies View Related

Best Performance Query

Dec 12, 2005

Hi:
I have the following query, can somebody help me?
SELECT            s.Id, s.NameFROM            Switch s INNER JOIN             SwitchTelephoneRange r ON s.Id = r.IdWHERE            '1526858' BETWEEN FromTelephone AND ToTelephone
Where the '1526858' is a phone number.
My problem is, I want to run the above query for each record in :
select Telephone from PhoneDirectory
So, each telephone number in the second phone, would macth the ' ' in the first query.
How can I do so? Do I need a loop? a cursor? Can you help please?
Thanks

View 5 Replies View Related

Query Performance

Nov 14, 2003

Hi,
I want to know query execution time as output. I want execution time only. this is for tuning purpose... Time displayed in the status bar is not helpful for me.
thanks.

View 1 Replies View Related

Query Performance

Mar 25, 1999

Hi there,
I'm having a big performance problems with sql query. What i have done is changes physical layout (rearanged the columns) in one of the tables in the database. I used bcp to get the data out and then in. There are about quarter million rows in the this table. I have created the same indexes but know the same query takes a long time to execute. I have noticed that the showplan is somehow different than it used to be. This query uses the table i have changed and another one that i haven't touched. I have updated the stats to no help.
Here are the show plans.
this one is slow
STEP 1
The type of query is INSERT
The update mode is direct
Worktable created for ORDER BY
FROM TABLE
SW_PERSON
Nested iteration
Index : swiPERSON10
FROM TABLE
SW_CASE
Nested iteration
Table Scan
TO TABLE
Worktable 1
STEP 2
The type of query is SELECT
This step involves sorting
FROM TABLE
Worktable 1
Using GETSORTED Table Scan

this one used to be fast
STEP 1
The type of query is INSERT
The update mode is direct
Worktable created for ORDER BY
FROM TABLE
SW_CASE
Nested iteration
Table Scan
FROM TABLE
SW_PERSON
Nested iteration
Index : PK_SW_PERSON_1__27
TO TABLE
Worktable 1
STEP 2
The type of query is SELECT
This step involves sorting
FROM TABLE
Worktable 1
Using GETSORTED Table Scan

I think the problem is with the fact that the fist one doesn't use the PK
key which is the one the links both tables. My question is how to force the query to use this index.
PS.
One thing i haven't done is to recreate indexes on the other table. But i don't think that would have made a differnece.
Thanks

View 4 Replies View Related

Query Performance

Oct 16, 2006

I have the following functions in my database

Code:


CREATE FUNCTION dbo.fnProductsRetrieveBySupplierID
(
@SupplierID int
)
RETURNS TABLE
AS
RETURN
(
SELECT *
FROM Products
WHERE SupplierID = @SupplierID
)

CREATE FUNCTION dbo.fnSuppliersRetrieveBySupplierID
(
@SupplierID int
)
RETURNS TABLE
AS
RETURN
(
SELECT *
FROM Suppliers
WHERE SupplierID = @SupplierID
)



I have been testing the performance of the following SQL statements:

Code:


1.
SELECT *
FROM Products INNER JOIN
Suppliers ON (Products.SupplierID = Suppliers.SupplierID)
WHERE Products.SupplierID = 3


2.
SELECT *
FROM dbo.fnProductsRetrieveBySupplierID (3),
dbo.fnSuppliersRetrieveBySupplierID (3)



I have built a loop to execute each statement multiple times and then compare the execution times. Although both queries produce the same result, the 2nd one (which uses the functions) is about twice as slow, does anyone know why?

thanks

View 1 Replies View Related

Performance Of A Query

May 21, 2006

Hi All,

I am joining three tables each table has got about 1.5 million rows,selecting data from these three tables and inserting into a table,to avoid transaction log issues I am running the query in a batch of size 50,000 rows,it is taking about 5hrs to insert all the 1.5 millions rows.

All the columns in the where clause have proper indexes,I ran show plan for the query and it is using indexes properly and not doing any table scan.I updated the statistics for all the indexes also.


query looks some thing like this.

insert into table d (col1,col2,col3,.............. )
values (a.col1,b.col2,c.col3 .....................)
from a,b,c
where a.id = b.id
and a.id = c.id
and a.id in between @minid and @currid

The @minid starts from 1 and @currid starts from 50000 ,I am running this in a loop, in next iteration @minid will become 50001 and currid 100,000 and so on.

Any idea why it is taking that much time?.

Thanks in advance,
bsr.

View 7 Replies View Related

Query Performance

Jan 22, 2004

I have two tables.
Employee
EmployeeCode int Primary Key

Employee_Stock
EmployeeCode int
StockCode varchar(10)
Primay key on (Employeecode, StockCode)..

There is no foreign key relation between these 2 tables.
Now my question is which query give more performance. and why?
1. Select * from
Employee INNER JOIN Employee_Stock on Employee.Employeecode = Employee_Stock.EmployeeCode

2. Create a foreign Key between Employee and Employee_Stock for EmployeeCode. and run the same query.

Actually we forgot to put the foreign key relationship between these 2 tables and we have lot of queries joining them..
Now if we add foreignkey, is it going to improve the performance or not?

Thanks
Ramesh

View 1 Replies View Related

Query Performance

Apr 8, 2008

I wrote a query and I use cursor in the query. When I run the query on dev box it takes 3 mins.
I moved the query to EPM database box and it takes forever to run.
Usually EPM database query performance is much better. How do I start debugging the poor performance?

How can I check if the query is creating any table locks?

Purpose of query: I get all the Companies (20000) and loop thru each company in the cursor and do calculations.

Thanks...

View 13 Replies View Related

Query Performance

Jun 27, 2007

Hi all
I want to check the query performance
How I should starT
I mean what is the plan to be followed

Thanks In Advance

Malathi Rao

View 3 Replies View Related

Query Performance

Mar 9, 2008

I have a query like below and it takes a aouple of seconds to run

select a.Registration_Key, ag.Agreement_Type_Name,p.ServiceProvider from dbo.Assessment a
INNER JOIN (
select distinct Registration_Key, p.ServiceProvider, max(CSDS_Object_Key) as [Sequence]
from dbo.Assessment a
INNER JOIN dbo.CD_Provider_Xref p
ON a.Provider_CD = p.Provider_CD
where Creation_DT >= '07/01/2007'
and Reason_CD = 1
group by Registration_Key, p.ServiceProvider
) as s1
ON a.CSDS_Object_Key = s1.Sequence
INNER JOIN dbo.CD_Provider_XREF p
ON a.Provider_CD = p.Provider_CD
INNER JOIN dbo.CD_Agreement_Type ag
ON ag.Agreement_Type_CD = a.Agreement_Type_CD
LEFT OUTER JOIN (
select distinct Registration_Key, p.ServiceProvider
, 1 as served
from dbo.Encounters e
INNER JOIN dbo.CD_Provider_Xref p
ON e.Provider_CD = p.Provider_CD
where Encounter_Begin_DT between '08/01/2007' and '08/31/2007'
and Procedure_CD is not null
and Encounter_Units > 0

) as s2
ON a.Registration_Key = s2.Registration_Key
and p.ServiceProvider = s2.ServiceProvider

group by a.Registration_Key, ag.Agreement_Type_Name, p.ServiceProvider



However, if i add a served field( stamped with 1) it takes forever to run.. All of join columns have indexes.. cluster and non-clustered.. and i don;t see any index fregmentaitons...




select a.Registration_Key, ag.Agreement_Type_Name,p.ServiceProvider, served from dbo.Assessment a
INNER JOIN (
select distinct Registration_Key, p.ServiceProvider, max(CSDS_Object_Key) as [Sequence]
from dbo.Assessment a
INNER JOIN dbo.CD_Provider_Xref p
ON a.Provider_CD = p.Provider_CD
where Creation_DT >= '07/01/2007'
and Reason_CD = 1
group by Registration_Key, p.ServiceProvider
) as s1
ON a.CSDS_Object_Key = s1.Sequence
INNER JOIN dbo.CD_Provider_XREF p
ON a.Provider_CD = p.Provider_CD
INNER JOIN dbo.CD_Agreement_Type ag
ON ag.Agreement_Type_CD = a.Agreement_Type_CD
LEFT OUTER JOIN (
select distinct Registration_Key, p.ServiceProvider
, 1 as served
from dbo.Encounters e
INNER JOIN dbo.CD_Provider_Xref p
ON e.Provider_CD = p.Provider_CD
where Encounter_Begin_DT between '08/01/2007' and '08/31/2007'
and Procedure_CD is not null
and Encounter_Units > 0

) as s2
ON a.Registration_Key = s2.Registration_Key
and p.ServiceProvider = s2.ServiceProvider

group by a.Registration_Key, ag.Agreement_Type_Name, p.ServiceProvider, served

View 3 Replies View Related

Help SQL CE Query - LOW Performance

Sep 12, 2006

Hi!

Sorry for bad english, I'm from Brazil.

In microsoft.public.sqlserver.ce haven't found a way to improve performance
of this query. Thanks for any help or reply!

This used to take almost 6 min !!! With index on E.Produto now takes about 30 sec...

1,909 row table

Ipaq 1950 - Samsung 300 Mhz - 32 MB RAM - Windows Mobile 5.0 - SQL CE
2.0


PK (all multiple columns) - tables:

Lotes - pk(Empresa, Lote, Contagem, Produto)

Contagem - pk(Empresa, Lote, Contagem, Produto)

Produtos - pk(Codigo)  // this field also is FK <=> Produto in all other
tables

Estoque - pk(Empresa, Ordem, Produto)

Part of my VB.NET code with SQL:


sql_grd_inv = "SELECT L.Empresa, L.Lote, L.Contagem, L.Produto" _
            & ", P.Unidade, P.Descr, P.Ref, P.Embgem, P.Marca" _
            & ", Sum(CASE WHEN E.Estoque IS NULL THEN 0 ELSE E.Estoque END)" _
            & "AS SomaEstoque, C.Qtde" _
            & " FROM (" _
            & "(Lotes L " _
            & "LEFT JOIN Contagem C ON (L.Empresa = C.Empresa) " _
            & "AND (L.Lote = C.Lote) AND (L.Contagem = C.Contagem) " _
            & "AND (L.Produto = C.Produto)" _
            & ") " _
            & "LEFT JOIN Estoque E ON (L.Empresa = E.Empresa) " _
            & "AND (L.Produto = E.Produto)" _
            & ") " _
            & "INNER JOIN Produtos P ON L.Produto = P.Codigo " _
            & "GROUP BY L.Empresa, L.Lote, L.Contagem, L.Produto" _
            & ", P.Unidade, P.Descr, P.Ref, P.Embgem, P.Marca, C.Qtde " _
            & "HAVING (L.Empresa='" & IncEmpresa & "') " _
            & "AND (L.Lote='" & Cbo_Lote_Pnl_Invent.Text & "') AND (L.Contagem='" _
            & Cbo_Cont_Pnl_Invent.Text & "') " _
            & "UNION " _
            & "SELECT " _
            & "C.Empresa, C.Lote, C.Contagem, C.Produto" _
            & ", P.Unidade, P.Descr, P.Ref, P.Embgem, P.Marca" _
            & ", Sum(CASE WHEN E.Estoque IS NULL THEN 0 ELSE E.Estoque END)" _
            & "AS SomaEstoque, C.Qtde" _
            & " FROM (" _
            & "(Contagem C " _
            & "LEFT JOIN Lotes L ON (C.Empresa = L.Empresa) " _
            & "AND (C.Lote = L.Lote) AND (C.Contagem = L.Contagem) " _
            & "AND (C.Produto = L.Produto)" _
            & ") " _
            & "LEFT JOIN Estoque E ON (C.Empresa = E.Empresa) " _
            & "AND (C.Produto = E.Produto)" _
            & ") " _
            & "INNER JOIN Produtos P ON C.Produto = P.Codigo " _
            & "GROUP BY  C.Empresa, C.Lote, C.Contagem, C.Produto" _
            & ", P.Unidade, P.Descr, P.Ref, P.Embgem, P.Marca, C.Qtde" _
            & ", L.Empresa, L.Lote, L.Contagem, L.Produto " _
            & "HAVING (L.Empresa Is Null) AND (L.Lote Is Null) " _
            & "AND (L.Contagem Is Null) AND (L.Produto Is Null) " _
            & "AND (C.Empresa='" & IncEmpresa & "') " _
            & "AND (C.Lote='" & Cbo_Lote_Pnl_Invent.Text & "') AND (C.Contagem='" _
            & Cbo_Cont_Pnl_Invent.Text & "') "

View 1 Replies View Related

Query Performance

Apr 26, 2006

Hello SQL Gurus,
From the query below, I am using 2 TOP functions to return the desired row. I am wondering if someone can shed some light on how to AVOID using 2 TOP statements and combine into just one select query?

select TOP 1 * from (select TOP 2 Num from A order by Num) X order by Num desc

Truly Appreciate your help as this performance issue has been bugging in my head for quite some time...

Sincerely,
-Lawrence

View 1 Replies View Related

Query Performance

Apr 16, 2008

Hi,

I am wondering if someone can clear my mind about a performance doubt.

What performs best using inner or left joins... I filter my data in the ON clauses or in the WHERE clauses...

Example 1:

FROM TABLE_A A INNER JOIN TABLE_B B ON A.ID = B.ID AND A.ID IN (@IDS)

Example 2:


FROM TABLE_A A INNER JOIN TABLE_B B ON A.ID = B.ID
WHERE A.ID IN (@IDS)



Consider that table A and B can contain large sets of data.

Best Regards,
Luis Simões

View 2 Replies View Related

Query Performance Help

Mar 14, 2008

I usually am all over answering these kinds of questions, but while I continue to work on this issue, maybe someone here can lend me a hand. A vendor application we run, stores metadata about backup blobs stored on a NAS device. The app basically backs up select folders on 1400 remote computers in the back office of our stores, and stores this on a NAS, while maintaining metadata about the BLOBs in SQL Server so that they can push recovery of the data back to the original store it came from. The database is roughly 80GB in size and has a single file group and is on its own dedicated LUN. It uses TempDB heavily, and this is not something that I can change, but TempDB is on a different disk array.

Today I spent hours on a conference call with them looking at a specific stored procedure that is used to clean up the records in the database after a BLOB file is deleted. A single BLOB file can have millions of related records in the database. There is a LEFT JOIN in the code that is against a table with 150 million + rows of data in it. The table size is fairly small, only 5 GB of data, but the LEFT JOIN spools 2.4GB of data to a Hash Match. It seems to me like the left join can't be removed, but I don't get how all of this works, because I didn't write the application. It is an INDEX SCAN. I can't seem to eliminate it. Is there anything I can do to help this thing out?

View 5 Replies View Related

Query Performance

May 7, 2007

I am attempting to get a better understanding of why my SQL 2005 setup when running a simple select statement on a large table is displaying very low IO in performance monitor. If i run a single Select * From testtable i see 4mbsec transfer and Disk readssec is around 8-9. This particular table is sitting on a single U320 10k drive so i expecting to see far more substantial IO. Does anyone have any information on how IO is consumed using different SQL operations so i can obtain a better understanding?

View 2 Replies View Related

SQL CE 3.5 Vs 3.0 Query Performance

Jan 21, 2008

So I am experimenting with upgrading a Windows Mobile application from .NETCF 2.0 to .NETCF3.5, along with moving my SQL 2005 Compact to SQL Compact 3.5. I have a database that I upgraded using the recommended methods (creating a datasource in VS2008, opening the SQL 2005 Compact .sdf file and allowing the tool to upgrade to SQL Compact 3.5). On the device (Dell Axim x51), with the .SDF files on an SD Card, the query, when executed against the SQL 2005 Compact database file, takes 1.5 seconds, but takes 1min41sec to execute on the SQL Compact 3.5 database.

This is a fairly simple query, with an inner join (using about 4 inner join constraints), a where clause (over about 3 things), and an order by clause. The execution plan for the SQL Compact 3.5 query shows index seeks (one consuming 2% and the other consuming 0%, with the inner join using 98%). The database files are on the order of 90MB.

Can anyone offer any suggestion why the SQL Compact 3.5 query performance would be so much worse than the SQL 2005 Compact performance?

Thanks,
Matthew Belk

View 21 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved