SQL Developer vs TOAD - query performance question
Somebody made me notice same queries are executing slower in SQL Developer than in TOAD. I'm rather curious about this issue, since I understand Java is "slow" but I can't find any other thread about this point. I don't use TOAD, so I can't compare...
Can this be related to the amount of data being returned by the query ? What could be the other reasons of SQL Dev running slower with an identical query ?
Thanks,
Attila
It also occurs to me that TOAD always uses the equivalent of the JDBC "thick" driver. SQL Developer can use either the "thin" driver or the "thick" driver, but connections are usually configured with the "thin" driver, since you need an Oracle client to use the "thick" driver.
The difference is that "thin" drivers are written entirely in Java, but "thick" drivers are written with only a little Java that calls the native executable (hence you need an Oracle client) to do most of the work. Theoretically, a thick driver is faster because the object code doesn't need to be interpreted by the JVM. However, I've heard that the difference in performance is not that large. The only way to know for sure is to configure a connection in SQL Developer to use the thick driver, and see if it is faster (I'd use a stop-watch).
Someone correct me if I'm wrong, but I think that if you use "TNS" as your connection type, SQL Developer will use the thick driver, while the default, "Basic" connection type uses the thin driver. Otherwise, you're going to have to use the "Advanced" connection type and type in the Custom JDBC URL for the thick driver.
Similar Messages
-
Install Oracle XE, SQL Developer, and Toad on the same machine?
I have been trying to install Oracle SQL Developer, Toad, and Oracle Express on my work computer. Installing SQL Developer and Toad was pretty straightforward, and I was able to browse the XE database with SQL Developer. But after installing Toad, problems started. Toad was using Oracle XE's registry settings to locate ORACLE_HOME and oci.dll. So I tried changing the settings for Oracle XE in the registry. Toad now works, but not Oracle XE. And while I was going through this all, I even had a time when I had Toad and oracle xe working, but not SQL Developer. It almost looks like you can choose two of the products, but not all three.
So, my question to the community at large is "Can it be done?". In what directories do you have each product installed? What environment variables do you have set? Where is your tnsnames.ora? What Oracle registry settings do you have set (namely HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE)?
I can post my current settings, but I've been through so many iterations that these current settings don't really matter that much.
Here are the details I am looking for
Path to sqldeveloper.exe
Path to oracle.exe (for Oracle XE)
Environment Variables
ORACLE_HOME
ORACLE_BASE
TNS_ADMIN
PATH (just the oracle stuff)
Registry Settings
HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORACLE_HOME
HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORACLE_BASE
HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\TNS_ADMIN
HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\OLEDB
HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORAMTS_CP_TRACE_DIRI don't use toad, but there should be no reason why you can't install all 3. SQL Developer is a very clean install and affects nothing else. It doesn't add to the path, or create any registry entries except for file associations.
A toad installation should pick up your oracle client (in this case the XE code). I am curious as to why you felt you had to change registry settings. What problem were you trying to fix?
My recommendation would be to uninstall everything, clean the registry and reinstall in the order XE, Toad, SQL Developer. Test in between installations and seek help for problems as you find them. Bear in mind that this is the forum for SQL Developer. QUestions about Oracle XE would be better answered in the dedicated forum, or in the Installation forum, and questions about Toad in a toad forum. -
SQL query performance question
So I had this long query that looked like this:
SELECT a.BEGIN_DATE, a.END_DATE, a.DEAL_KEY, (select name from ideal dd where a.deal_key = dd.deal_key) DEALNAME, a.deal_term_key
FROM
ideal d, ideal_term a,( select deal_key, deal_term_key, max(createdOn) maxdate from Ideal_term B
where createdOn <= '03-OCT-12 10.03.00 AM' group by deal_key, deal_term_key ) B
WHERE a.begin_date <= '20-MAR-09 01.01.00 AM'
* and a.end_date >= '19-MAR-09 01.00.00 AM'*
* and A.deal_key = b.deal_key*
* and A.deal_term_key = b.deal_term_key*
* and a.createdOn = b.maxdate*
* and d.deal_key = a.deal_key*
* and d.name like 'MVPP1 B'*
order by
* a.begin_date, a.deal_key, a.deal_term_key;*
This performed very poorly for a record in one of the tables that has 43,000+ revisions. It took about 1 minute and 40 seconds. I asked the database guy at my company for help with it and he re-wrote it like so:
SELECT a.BEGIN_DATE, a.END_DATE, a.DEAL_KEY, (select name from ideal dd where a.deal_key = dd.deal_key) DEALNAME, a.deal_term_key
FROM ideal d
INNER JOIN (SELECT deal_key,
deal_term_key,
MAX(createdOn) maxdate
FROM Ideal_term B2
WHERE '03-OCT-12 10.03.00 AM' >= createdOn
GROUP BY deal_key, deal_term_key) B1
ON d.deal_key = B1.deal_key
INNER JOIN ideal_term a
ON B1.deal_key = A.deal_key
AND B1.deal_term_key = A.deal_term_key
AND B1.maxdate = a.createdOn
AND d.deal_key = a.deal_key + 0
WHERE a.begin_date <= '20-MAR-09 01.01.00 AM'
AND a.end_date >= '19-MAR-09 01.00.00 AM'
AND d.name LIKE 'MVPP1 B'
ORDER BY a.begin_date, a.deal_key, a.deal_term_key
this works much better, it only takes 0.13 seconds. I've bee trying to figure out why exaclty his version performs so much better. His only epxlanation was that the "+ 0" in the WHERE clause prevented Oracle from using an index for that column which created a bad plan initially.
I think there has to be more to it than that though. Can someone give me a detailed explanation of why the second version of the query performed so much faster.
Thanks.
Edited by: su**** on Oct 10, 2012 1:31 PMI used Autotrace in SQL developer. Is that sufficient? Here is the Autotrace and Explain for the slow query:
and for the fast query:
I said that I thought there was more to it because when my team members and I looked at the re-worked query the database guy sent us, our initial thoughts were that in the slow query some of the tables didn't have joins and because of that the query formed a Cartesian product and this resulted in a huge 43,000+ rows matrix.
In his version all tables had joins properly defined and in addition he had that +0 which told it to ignore the index for the attribute deal_key of table ideal_term. I spoke with the database guy today and he confirmed our theory. -
SQL Developer vs TOAD: connection stability
I am trying to persuade a group of developers to switch from TOAD to SQL Developer. The feature set of version 1.5 is quite nice; and most of our users don't need the extra bells and whistles of TOAD. However, in side-by-side situations, it seems that TOAD gets better response times. In particular, the connection for SQL Developer sometimes seems to freeze and then come back later, while TOAD does not seem to be affected.
Our DBA thinks that the difference may be from SQL Developer using a JDBC connection while TOAD uses Oracle SQLNET. He said that switching to an LDAP server for name resolution might make the difference; but we really don't have much experience at this level of detail on the connections.
Is anyone else having a similar issue? Has anyone been able to 'equalize' the performance of the two products?
You insights are welcome.However, in side-by-side situations, it seems that
TOAD gets better response times. In particular, the
connection for SQL Developer sometimes seems to
freeze and then come back later, while TOAD does not
seem to be affected.
Our DBA thinks that the difference may be from SQL
Developer using a JDBC connection ... I think the problem ist not SQL Developer\JDBC itself but rather the Java Runtime Environment. The behavior you describe sounds like that Garbage Collector hits you. SUN trys to make the GC better in each Java version, so I suggest you update your JRE to the newest one you can get(today: 1.6.0_06 from java.sun.com).
After doing that, install "Oracle SQL Developer for Windows, with JDK already installed" to make sure that SQL Dev. use the new one. You can check the used java version within SQL Dev. at the "About" dialog (register: version)
If you are familiar with java you should play with some gc and memory settings. Details about that you find here: http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
Andreas -
SQL Developer fails to query table
I am trying to use SQL Developer (v3.2.20.09) to query a particular table in an Oracle 10G database using a simple "select * from table" query. When I run the query SQL Developer sits there forever waiting for results but nothing is every returned.
The table is relatively small, just a few thousand rows and just half a dozen columns (mixture of numbers, short text strings and datetimes). I can run other queries on the table in question so I know I have privileges, it's just when run a simple query to return all columns and all rows it fails. I even tried to an export of the table using Tools->Database Export but that too just sat there forever failing to complete.
Any ideas? It seems that there is just something in the table that SQL Developer doesn't like.I've never used sqlplus before but I just tried it and it runs the same query (select * from [table] where rownum <= 40) without any problems. The strange thing is that once I could see which row was row 40 in sqlplus I queried just that one row in SQL Developer (using the primary key column) and it worked fine.
I did a bit more experimenting and it doesn't look like a problem with that row in particular just with displaying more than a certain number of rows. The first column on the table is called OBJ_ID and is a unique integer which forms the primary key. Row 40 has OBJ_ID = 53. I tried running:
select * from [table] where obj_id between 40 and 53 - no problems
select * from [table] where obj_id between 30 and 53 - no problems
select * from [table] where obj_id between 20 and 53 - no problems
select * from [table] where obj_id between 10 and 53 - failure as above (no errors but SQL Developer never displays the results) -
SQL query (pl/sql function body returning query) performance issue
I create my report in building my sql instruction with ( SQL Query pl/sql function body returning sql query );
My report take more than 20 seconds however if i did a cut and paste with the sql code in TOAD the same sql take 1 second.
To try to discover the source of the problem; i take the sql generated by the function and i create another report ( sql query ) this new report take 2 seconds.
My query is very big 25,000 characters with database link.
What is the difference between SQL-quey and sql-query(pl/sql function body returning sql query)
Thanks
MarcMarc,
Firstly...don't compare the timings from Toad, since often Toad only fetches the first few records for you (i.e. it pages them).
Secondly....the database link could be a factor here, but without seeing your query it's too hard to say.
Can you post the query somewhere (on a webserver say)? -
SQL Developer and TOAD connection.
Hi,
I am able to see the DDL script for tables using TOAD, but NOT using SQL Developer (2.1.1). Same user, pass, and tnsname file.
They use same tnsname.ora file on my computer. I set basic and TNS connection for SQL Developer.
The connection is from my computer to the server (Oracle 11.1.0.7 EE).
ORA-31603: object "ALARM_DEFINITION" of type TABLE not found in schema "AIRCOM"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3241
ORA-06512: at "SYS.DBMS_METADATA", line 4812
ORA-06512: at line 1
It is same with packages. I cannot see package body.
What is the different and which additional privileges I need to see the DDL script?
Thanks in advance for your help!
KonstantinI don't think it's a connection issue. There seem to be differences in how Oracle and Toad access system views to show objects. If you search the boards you see it has effected a couple of people. Sometimes they post what permissions they changed to get things to work for them.
ie... Re: Issue with viewing Package Body in SQL Developer 2.1 RC1
I don't think I've seen any official documentation to indicate what privileges need to be granted in order to see them thought. And I think there is a bug that prevents generating DDL for tables owned by other users. I don't know if that extends to generating stored procedure code. -
SQL Developer replacement for Query Builder?
Our developers use query builder to quickly develop sql code w/conditions, joins, where clauses, etc. I just installed release 2 of SQL Developer and am trying to figure out if this is a viable replacement for query builder. Is there a graphical "query builder" component as part of SQL Developer?
Barry, I would agree that it should be clean and easy to use. I started using Data Browser 2.0 and migrated to Query Builder 6.0.7.1.0 and while Query Builder is no longer it's own product it's integrated into Reports Developer 10g. The basic layout and operation has been consistent thru the life cycle and I would think you'd keep the "look and feel" consistent with what's currently available. (might simplify integrating it too). My biggest complaint with Query Builder 6.0.7 (se don't use the 10g version) is that it errors when opening a schema with more than 8192 objects. As an E-Business Suite 11.5.10 customer this is an issue for our developers when logging in as the standard APPS user.
So here would be my "wish list"
1. consistent look and feel with "older" versions of Browser/Query Builder
2. removal of 8192 object limitation
3. ability to open older .brw format files
Certainly more improvements would be possible by integrating with SQL Developer and would be welcomed - this wish list is coming from a user who has MANY .brw files in the older 6.0.7 format. -
SQL Developer 1.1 Query Builder does not display connection tree
I have installed SQL Developer 1.1 on a PC running Windows XP SP2. I am connecting to Oracle 9.2.0.7.0.
After connecting to the database, I right click in the SQL Worksheet and select Query Builder and when the new window is displayed, there are no tables to select from.
What is causing this?Hi Antony,
Upgrading from SP7 to SP9 fixed a lot of problems for me! It's worth trying.
Problems solved for me:
Page requests take about 2 minutes to display page (now within a few seconds)
KM SQL logging (30-50Mb per minute) problem fixed.
There are some problems upgrading to SP9, but searching this forum will help you in finding some solutions for this
Regards,
Noel -
SQL Developer 3.0 Query Builder Issue
When compiling a query within the Query Builder I cannot execute the query - the RUN statement button is disabled. There also appears some "lagging" when building the query.
Is this a bug within the SQL Developer 3.0?
This has the potential to be an excellent tool. I am pleased that this version now gives you function to amend views.
Edited by: user13116583 on Mar 31, 2011 2:48 PMHi Marc -
With respect to the "lagging" see Re: 30EA2 - Query Builder locks up when I select the tab. on design trade offs made during the 3.0 early adopter cycle.
The run button should be enabled as soon as you type anything in the Worksheet or drag/drop anything on the Query Builder. Can you give me more detail on what you are doing/seeing?
Brian Jeffries
SQL Developer Team -
SQL Developer 2.1.1 Editor question
Finally the problem posted here Re: SQL Developer 2.1 no longer allows to edit another granted schemas resolved.
Now we can edit all granted schemas. I think, this is the most important improvement in this version! Thank you!
But now, IMHO, we have too much freedom!
For example: As soon as you click on object in the navigational panel on left side, the new worksheet is opened and YOU CAN EDIT a source code!!
Well... Why do we need the EDIT option in the Right Click Content Menu then? It is absolutely redundant!
I think, that click in the navigational panel should open a source only in READ ONLY mode! This sounds only logical, right? Most of the time code just needs to be browsed, so why have a risk of accidental damage of code?
Edit should be allowed only if you intentionally select the Edit option from the content menu.
Am I right or am I right?
Obviously, this is not a critical issue, but it would be a good idea to fix it in the next releaseI swear I've read requests like this before so I checked the feature requests.
Search: read only
http://htmldb.oracle.com/pls/otn/f?p=42626:39:59364384205540:::::&success_msg=Action%20Processed.%2F7908DFD98D4CB7965D7D44992CCF608F%2F
I added my vote just for the hell of it. Looks like it's already slated for the 3.0 release. -
SQL Developer Data Wizard - Row terminator question
Hi all,
I'm new to SQL Developer and am using the wizard to import a dataset with a non-standard row terminator
The row terminator essentially looks like 2 spaces but its actually 2 newline characters.
In SQL Server I specified the following in the SQL Server wizard and it worked:
{CR}{LF}{CR}{LF}
What's the equivalent for oracle? Or what should I type in the row terminator field of the SQL Data upload wizard instead of the default: Windows <CR><LF>
Thanks for your help!
Edited by: 888130 on Sep 28, 2011 7:38 AM
Edited by: 888130 on Sep 28, 2011 7:38 AMHi!
As far as I know, the line terminator for the import wizzard has to be {CR}{LF} or {CR} or {LF}.
So your best shot may be to preprocess your import file and replace {CR}{LF}{CR}{LF} with {CR}{LF}.
Another oportunity is to use SQLLoader:*
Documentation:
http://download.oracle.com/docs/cd/E11882_01/server.112/e22490/ldr_control_file.htm#i1006645
Skip empty lines:
Ignore empty rows at end
Best regards,
Matt -
SQL Developer 2.1: Poor performance on 11g
We are experiencing poor response times for queries using sql developer 2.1 with our new 11g upgraded database (11.1.0.7). A bit of investigation has shown that a simple
select 1 from dual;
causes
SELECT table_owner, table_name
FROM all_synonyms
WHERE owner IN (USER, 'PUBLIC') AND synonym_name = :1
Has anybody else seen this?
It is not happening with other IDEs.Have found out that if the data dictinary inquries drop the the SYS qualifier then we can implement the dolution on metalink. Any chance that this alteration can be implemented? At the moment we cannot use the tool as it is causes too many issues.
Colin -
30EA1: 2nd instance of the sql developer delivers no query results
Hi,
the first instance works like expected, the 2nd one doesn't delivers any result in queries and in the Messages i found that Error:
SEVERE 43 0 Error while registering Oracle JDBC Diagnosability MBean.
best regards
Wernerhi,
well - the main reasons have been already discussed; another intresting one
(i don't know if somebody else was already running into it): sometimes i start e.g. a long running pl-sql block in the window
Then i go back to e.g. the code editor to take a look on another part of the code which i want to edit - then the sql developer freezes
(i think because something is executed through the main connection - and unfortunatly the main session is already executing something)
When the pl-sql block is finished i can use the sql developer instance again; but in the meantime i need another instance
in my regular work i use 3-4 instances of the sql developer
(like mentioned above - to prevent myself by modifying the productive db during i am working on the
development one in the same schemas, to work on another topic which a customer asked me without loosing my old work or because a window freezed)
Here an idea (i know - maybe it is dirty) - the sql developer could open always 2 connections - one for the communication of the tool to the database (which can't be used by a window)
and one for the window (sure - i am aware that i can open an unshared connection window, but sometimes i just forget to do that)
Another benefit of that: currently a lot of statements are sent through the connection - if i want to trace something i have to do it in the sqlplus because these statements are messing up my trace
however - i took a look into the new version and i am quite impressed, a lot of new cool features
best regards
Werner -
Sql:variable and XML query performance
Can someone help with sql:variable() in xml queries? It seems that when I attempt to reference variables with the sql:variable(...) function in an xpath function (exist or nodes) it comes up with a totally different query plan, possibly ignoring
my secondary indices like the ones for VALUE, PATH.
But if I replace sql:variable("@p_ObjectIdentifierForReference") with the literal (ie. "ord/p/ord0616.p") then it uses secondary indices more consistently.
Below you will see an unsuccessful attempt to get the query to "OPTIMIZE FOR" a specific literal value of @p_ObjectIdentifierForReference. But this doesn't give work. It doesn't give me a plan using the secondary index I expect.
Ideally there would be a way to get the sql:variable(...) function to give the same query plan as a literal. Not sure why that isn't the default behavior.
DECLARE
@p_ObjectIdentifierForReference
varchar(500);
SET
@p_ObjectIdentifierForReference
= 'ord/p/ord0616.p';
WITH
XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004'
as D)
SELECT
XREF_FileDataReference.XREF_FileData
AS XrefFileData,
InnerRowNode.value('/D:Reference[1]/D:File-num[1]',
'int')
AS FileNumber,
InnerRowNode.value('/D:Reference[1]/D:Line-num[1]',
'int')
AS LineNumber
FROM
(SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.')
AS InnerRowNode
FROM
XREF.XREF_FileData
OUTER APPLY
DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference")
and @Reference-type = "RUN"]')
as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier
= sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]')
= 1)
AS XREF_FileDataReference
INNER
JOIN XREF.XREF_MemberBuilt
ON XREF_MemberBuilt.XREF_FileData
= XREF_FileDataReference.XREF_FileData
INNER
JOIN XREF.XREF_FileEntry
ON XREF_FileEntry.XREF_FileEntry
= XREF_FileDataReference.XREF_FileEntry
WHERE
XREF_MemberBuilt.XREF_ProjectBuilt
= 69
OPTION(RECOMPILE,
OPTIMIZE FOR (@p_ObjectIdentifierForReference
= 'ord/p/ord0616.p')I tried to create a "repro" of your query so we can work on it and try and improve it, but I got the best results by just adding text() and [1] to it, eg
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
FROM (
In my main repro, even with a large piece of xml with 100,000 elements, there still wasn't much difference between the queries:
USE tempdb
GO
IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = 'XREF' )
EXEC( 'CREATE SCHEMA XREF' )
GO
IF OBJECT_ID('XREF.XREF_FileData') IS NOT NULL DROP TABLE XREF.XREF_FileData
CREATE TABLE XREF.XREF_FileData
rowId INT IDENTITY,
DataXref XML,
XREF_FileData INT,
XREF_FileEntry INT,
CONSTRAINT PK_XREF_FileData PRIMARY KEY ( rowId )
GO
IF OBJECT_ID('XREF.XREF_MemberBuilt') IS NOT NULL DROP TABLE XREF.XREF_MemberBuilt
CREATE TABLE XREF.XREF_MemberBuilt
XREF_ProjectBuilt INT,
XREF_FileData INT
GO
IF OBJECT_ID('XREF.XREF_FileEntry') IS NOT NULL DROP TABLE XREF.XREF_FileEntry
CREATE TABLE XREF.XREF_FileEntry
XREF_FileEntry INT
GO
-- Create larger piece of xml for repro
;WITH XMLNAMESPACES ( DEFAULT 'uri:schemas-progress-com:XREFD:0004' ), cte AS (
SELECT TOP 100000 ROW_NUMBER() OVER ( ORDER BY ( SELECT 1 ) ) rn
FROM master.sys.columns c1
CROSS JOIN master.sys.columns c2
CROSS JOIN master.sys.columns c3
INSERT INTO XREF.XREF_FileData ( DataXref, XREF_FileData, XREF_FileEntry )
SELECT
SELECT
CASE rn WHEN 9999 THEN 'ord/p/ord0616.p' ELSE CAST( rn AS VARCHAR(20) ) END AS "@Object-identifier",
'RUN' AS "@Reference-type",
SELECT
rn AS "File-num",
rn * 10 AS "Line-num"
FOR XML PATH(''), TYPE
) AS "*"
FROM cte
FOR XML PATH('Reference'), ROOT('Source'), TYPE
).query('<Cross-reference xmlns="uri:schemas-progress-com:XREFD:0004">{.}</Cross-reference>'), 1, 100
INSERT INTO XREF.XREF_FileEntry ( XREF_FileEntry )
VALUES ( 100 )
INSERT INTO XREF.XREF_MemberBuilt ( XREF_ProjectBuilt, XREF_FileData )
VALUES ( 69, 1 )
GO
--SELECT * FROM XREF.XREF_FileData
--SELECT * FROM XREF.XREF_FileEntry
--SELECT * FROM XREF.XREF_MemberBuilt
--GO
-- Add primary XML index
CREATE PRIMARY XML INDEX xidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
GO
-- Add value, property and path xml indexes
CREATE XML INDEX xvalidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR VALUE
CREATE XML INDEX xpthidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR PATH
CREATE XML INDEX xprpidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR PROPERTY
GO
:exit
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
GO
DECLARE @p_ObjectIdentifierForReference varchar(500);
SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('/D:Reference[1]/D:File-num[1]', 'int') AS FileNumber,
InnerRowNode.value('/D:Reference[1]/D:Line-num[1]', 'int') AS LineNumber
FROM (
SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.') AS InnerRowNode
FROM XREF.XREF_FileData
OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
) AS XREF_FileDataReference
INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
GO
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
GO
DECLARE @p_ObjectIdentifierForReference varchar(500);
SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
FROM (
SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.') AS InnerRowNode
FROM XREF.XREF_FileData
OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
) AS XREF_FileDataReference
INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
GO
So I guess I'm saying I cannot reproduce your problem on SQL 2008 R2 or SQL 2012. Does anything about this repro stand out as different from your situation?
Looking at your query I would say you might consider the following:
are you really seeing big differences in query duration?
pretty much ignore estimated plan costs for xml queries
consider breaking it up; eg carve off the xml then do the joins? If poor cardinality estimation is part of the problem this might help
Understand what PATH, PROPERTY and VALUE are for, then only create the ones you need
do you really have the range of queries that requires all three?
this is still a great article on xml indexes:
http://technet.microsoft.com/en-us/library/ms191497.aspx
What's performance like with the primary xml index only?
If performance is that important, consider materialising the columns permanently
I think the buffer_descriptors stuff is a distraction - mostly your cache is warm right?
plan forcing could be a last resort
Selective XML indexes in SQL 2012 onwards are great : ) much less storage required for example but much more specific
Maybe you are looking for
-
Display customer details one by one in alphabetical order in alv report?
Hi experts, my requirement is , I want to display customer name and city as top and then for particular customer's details (like invoice no's,due date, vat.cst etc) display in alv grid format,and then next customer name and detals .....etc.(custome
-
IWeb 09 major bug - losing site - believe it's photo albums and photo pages
I have repeatedly lost my site now 3 times since upgrading. The problem appears to be when editing photo album pages with a few photo albums on them and then rearranging those albums and pages between sites. I can't be more specific at this stage, as
-
IPhone Wi-Fi Sync menù, how delete computer history ???
Hi to all, on my iPhone 4S in "iTunes Wi-Fi Sync" tab is listed two itunes libraries computer, one is old pc that have formatted the HD, my question is: how remove this computer from iPhone "iTunes Wi-Fi sync" menù many thanks in advance
-
AMD Releases Catalyst 7.7 http://ati.amd.com/support/driver.html New Features: New Catalyst™ Control Center Avivo features 12X and 24X Anti-Aliasing support for the ATI Radeon™ HD 2900 XT and ATI Radeon™ HD 2600 Series kind regards
-
Cross-site Scripting Vulnerability OAS-10g/10.1.2.0.0 OHS
Has anyone confronted the Cross-site scripting Vulnerability with 10g and OHS 10.1.2? We are about to put our first APEX box into production, but we need to fix this vulnerability first. I did some searching around but failed to come up with anything