Solved

Poor performance of linked oracle server

Posted on 2004-09-29
6
321 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
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

 
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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

717 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