Solved

Poor performance of linked oracle server

Posted on 2004-09-29
6
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 143

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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

738 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