Solved

Poor performance of linked oracle server

Posted on 2004-09-29
6
317 Views
Last Modified: 2012-06-27
Hi there

Am wondering if anyone may able to offer any suggestions for a problem I'm having with a SQL linked servers.

I've got a SQL server running which has a linked server to an oracle database.  I'm finding that a query run via the SQL server takes signifigantly longer than if I run the same query with a straight ODBC connection. (4 seconds on ODBC vs 4 minutes 50 seconds with a linked server.)

Any ideas about what could be causing the lag?

Regards


Marty
0
Comment
Question by:martypitt
6 Comments
 
LVL 34

Expert Comment

by:arbert
ID: 12187298
Maybe--can you post the query.  What happens if you use OPENQUERY against the server instead of using the linked server directly?

select * from openquery(yourlinkedservername,'thesql statement')


When you use a linked server, SQL Server will pass the criteria to the server that it thinks it can "safely" pass.  If it doesn't know how to pass a where clause or function, it will select all the records from the linked server and perform the criteria on the local SQL Server instead.  When you use openquery, a passthru query is actually passed.

Brett
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 12187704

With ODBC Connection U get only partial data(If ur data has alot of rows)

But when u use it with penquery from a linked server, SQL Server would try to get all rows into a temp Table in Tmpdb, for that reason it would took along time.

If not the problem would be Client Connection Drivers.

Or ur linked Server Oracle Db Connection Provider could be different then the ODBC Driver.


Melih SARICA

0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 12188053
as Arbert indicates, the problem might be the "query" so that SQL server cannot optimize it.

Sample Query with probable bad performance:
select * from OracleServer..Schema.table1
, OracleServer.Schema.Table2
where table1.pk = table2.pk

Sample query with best performance:
select * from OpenQuery ( OracleServer,
' select col1, col2, .... from Schema.table1
, Schema.Table2
where table1.pk = table2.pk
' )

The reason is explained by non_zero: in the first case, the join is performed on the local Sql server, thus all the data from both tables needs to be transferred to the sql server.
The second sample passes the sql to the oracle box, the join is performed on the oracle box, and only the results are send back

Cheers

CHeers
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 10

Expert Comment

by:imrancs
ID: 12192471
hmmm, good information for me as well
0
 
LVL 34

Expert Comment

by:arbert
ID: 12192485
Always --especially with linked servers--you finally figure out some workarounds for their poor performance...
0
 
LVL 34

Expert Comment

by:arbert
ID: 12195625
So what did you find the problem was?
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question