Explain Plan in SQL Developer vs. SQLPlus

Hi everyone,
I've got a quick question. Why would an explain plan hang in SQL Developer but come back immediately in SQL Plus?
For example, in SQL developer, I write my statement and use the F6 command to bring up the explain plan and it just hangs and hangs. It looks like it's trying to generate an explain plan, but it's been running for hours now.
When I log into SQL Plus, I do a
SQL> explain plan for <query>:
SQL> select * from table(dbms_xplan.display);That whole process takes less than a minute to get the explain plan.
Is there something fundamentally different being executed by SQL Developer?
Thanks!
-Joe

Joe,
F6 in SQL Developer runs an AutoTrace, which actually runs the SQL and also displays timings and the explain plan. If you only want the explain plan, use F10.
Regards,
Bob

Similar Messages

  • Explain Plan in SQL Developer 1.5.1

    How do I run Explain Plan against a Stored Package using SQL Developer 1.5.1?
    I'm not familiar with this tool and need to examine a specific package.
    Thanks.

    AFAIK, you can only get an explain plan for SQL statements, not PL/SQL code...
    K.

  • What are the permissions needed to run explain plans via sql develeper?

    Are the permissions the same in Sql Developer to run explain plans like they are when you run them via sql*plus?

    Yes same permission because the explain plan does not tie to the tools.

  • Difference in data retrieved from sql developer and sqlplus prompt

    SQL> select distinct snap_time from perfstat.stats$idx_stats;
    SNAP_TIME
    21-MAY-07
    05-JUN-07
    but using sql developer
    select distinct snap_time from perfstat.stats$idx_stats;
    SNAP_TIME
    21-MAY-07
    05-JUN-07
    13-JUN-07
    but can anyone explain the difference because it's the same database

    SQL> select distinct snap_time from
    perfstat.stats$idx_stats;
    SNAP_TIME
    21-MAY-07
    05-JUN-07
    but using sql developer
    select distinct snap_time from
    perfstat.stats$idx_stats;
    SNAP_TIME
    21-MAY-07
    05-JUN-07
    13-JUN-07
    but can anyone explain the difference because it's
    the same databaseIt looks to me during the interim between you run the query in sqlplus and SQL Developer, statspack generated a new snapshot.
    Check your DBA_JOBS see if there's any auto statspack collection job.

  • ORACLE SQL DEVELOPER and SQLPLUS

    How can I run the sqlplus command inside of ORACLE SQL DEVELOPER?
    Whe I try to run show SGA command , I get "SQLPLUs command skipped"

    jung1975,
    I have SQL Developer version 1.0.0.14 installed on my PC.
    Under the "Tools" menu, there is a "SQL*Plus" item.
    However, you need to have access to the "SQL*Plus" executable.
    Since my database server is on a different machine (to my PC), that means I need to have Oracle Client also installed on my PC.
    Good Luck,
    Avi.

  • Explain plan and SQL profile.

    Hi ,
    I got a sql tuning result for one query , and i need to understand the below fileds in the explain plan
    operation lineid object object_type order rows bytes cost time cpucost iocost
    any document to understand will be appreciated
    and in recomendation i got Consider accepting the recommended SQL profile. suppose if it was not feasible after accepting the SQL profile can i revert back.
    Thanks

    user12266475 wrote:
    Hi ,
    I got a sql tuning result for one query , and i need to understand the below fileds in the explain plan
    operation lineid object object_type order rows bytes cost time cpucost iocost
    any document to understand will be appreciated
    and in recomendation i got Consider accepting the recommended SQL profile. suppose if it was not feasible after accepting the SQL profile can i revert back.
    Thankshttp://docs.oracle.com/cd/E11882_01/server.112/e16638/toc.htm
    Thread: HOW TO: Post a SQL statement tuning request - template posting
    HOW TO: Post a SQL statement tuning request - template posting

  • Efficient way to read through big explain plan and genterate html explain plan for sql id's executed in past

    Hi,
    I have a sql which is recently having a performance problems in Production. I have generated a explain plan for it trying to find out what it is doing but plan itself is close to 1000 lines. I want to check if there is any efficient way to go through big plan like this one and quickly find the damaging areas..
    2) I also wanted to know if there is way to generate explain plans in HTML format which executed in past and have entry in dba_hist_sqltext.
    3) I also have two sql_monitor reports which I want to compare. is there any efficient way to do it as well?
    Please share your thoughts!
    Thanks in advance!
    Regards,
    Suman-

    Hi,
    I suggest you can try running sql advisor on the query maybe something fruitful comes up
    http://www.oracle-base.com/articles/11g/sql-access-advisor-11gr1.php
    I am not sure about the explain plan being printed in html format but
    You may also want to try the sqlhistory.sql query from below page
    http://evdbt.com/scripts/
    I have used it many times to check on executions and explain plans which may have changed over the period
    I have faced it many times , the query picks up a bad explain plan and performs poorly

  • Explain plan for SQL running in a session

    Hi. Can you get the explain plan information for sql that's currently running in a session? I know I can use the session report to see the active SQL, but I don't know if it's possible to get the explain plan information from there, like you can with TOAD's session manager.

    I've put together a query for the v$sql_plan in 9iR2.
    Depending on what you use, you can probably drop some columns (eg OTHER and partition columns) and you could drive it from the v$session by getting the hash_value from there for the sid you are interested in :
    (select * from v$sql_plan where hash_value =
    (select sql_hash_value from v$session where sid=:sid))
    select level, optimizer, lpad('_',1*(level-1),'_')||operation operation,
    options, object_owner||'.'||object_name obj_name, search_columns,
    ltrim(to_char(cardinality,'999,999,999')) no_rows,
    ltrim(to_char(bytes/1024,'999,999')) kbytes, cost tot_cost,
    object_node link, id, parent_id, other_tag||':'||other other,
    partition_start, partition_stop, cpu_cost, io_cost,
    access_predicates, filter_predicates,
    round(temp_space/(1024*1024),2) temp_space_mb
    from (select * from v$sql_plan where hash_value = :hash_val)
    start with id=0
    connect by prior id = parent_id and prior child_number = child_number
    order by child_number, id, position;

  • Is plan_table necessary for an explain plan?

    Hi, I've noticed that an explain plan for a query can be obtained by setting autotrace on. However, when I get a result from the autotrace, it shows no records in the plan_table table. I just want to check with others to make sure it's clear that a plan_table table isn't necessary to obtain an explain plan for a query. I've also noticed that when I hit the explain plan button in sql developer, there's no records in the plan_table table.

    Girish Sharma wrote:
    arizona9952 wrote:
    Hi, I've noticed that an explain plan for a query can be obtained by setting autotrace on. However, when I get a result from the autotrace, it shows no records in the plan_table table. I just want to check with others to make sure it's clear that a plan_table table isn't necessary to obtain an explain plan for a query. I've also noticed that when I hit the explain plan button in sql developer, there's no records in the plan_table table.What is your sql developer version ? If it is 3.0 then sql developer rollbacks the rows after fetching the plan for display. So you must rely on the Autotrace or Explain Plan result tabs.
    Similar discussion in below thread:
    Choose specific plan_table in SQL Developer 2+?
    Regards
    Girish SharmaThanks Girish. I'm running SQL developer version 3.1, so that explains why the plan_table table shows empty after I run an explain plan in SQL developer.

  • Explain Plan in sqldevloper

    Hi,
    in sqldevloper 3.1.07 some users (system or those with DBA role) can generate an explain plan but not all users.
    Is there any option or privilege to grant ?
    Thank you.

    F6 : in SQL Developer runs an AutoTrace,and actually runs the SQL and also displays timings and the explain plan.
    F10. : explain plan
    Read
    http://www.thatjeffsmith.com/archive/2012/02/quick-tip-comparing-explain-plans-with-sql-developer/

  • Explain Plan Optimizer

    How do you change the optimizer used by the explain plan in SQL Developer? It seems to only allow you to let Oracle choose. I would like the ability to run it by different optimizers.

    Choose usually equals CBO. That may have been a typo or something. In a perfect world, you set the database to choose and everything works optimally. In reality, the CBO, while being very good, is not perfect. The old adage of 'garbage in, garbage out' becomes very evident when using the CBO because bad, or incomplete stats can cause it to behave badly and complex queries can confuse it as well.
    Query help:
    asktom.oracle.com - Tom Kite is probably the best performance guy in the world for Oracle. His site has tons of help and insight into how the database works. He also has a few books.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:9438791572789777368::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:231814117467
    Oracle has a classroom training program for query performance tuning. It is pretty good and any serious oracle developer should probably pony up the cash for that course.
    http://education.oracle.com/pls/web_prod-plq-dad/show_desc.redirect?dc=D17265GC10&p_org_id=1001&lang=US&source_call=
    or search for 'SQL Tuning' on education.oracle.com
    Also, oracle's documentation on tuning is pretty good. Tom's thread that I linked to above points to oracle's documentation.
    As for why an outer join would invalidate an index. In most cases, the reason behind that is because an index, unless specially written, will not index a null value. Therefore, depending upon the direction of the outer join, it may not be able to use the index since it needs to return the nulls on one side. Also, under the CBO, if it detects that a lot of rows will be returned, or more correctly, need to be read, it will usually choose to perform full table scans with hash or merge joins because it is faster and more efficient than reading tons of rowids from the index and one by one reading the row data.
    I had better leave it at that. We are not exactly on the correct forum to discuss query tuning. That is probably best done on the sql and pl/sql forum or asktom.oracle.com. Hopefully I have pointed you to the resources that you need.
    Best of luck.
    Eric

  • Sql Explain Plan

    Hi Guys
    I am new to SQL Tuning and i wanna know what exactly are the tables involved in finding the explain plan of sql's and what all the views that needs to be queried to find the explain lan of a query. Kindly help me .
    Thanks
    Ram

    plan_table is used to get execution plan of any query. this table can be created with the script utlxplan.sql. You can find the script under ORACLE_HOME/rdbms/admin folder.
    The process for getting the execution plan is
    SQL> explain plan for
    2 select * from emp where employee_id=12 ;
    Explained.
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
    you can run the utlxpls.sql script also to get formated output and which can be found in ORACLE_HOME/rdbms/admin folder.
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU) |
    | 0 | SELECT STATEMENT | | 1 | 42 | 3 (0)|
    |* 1 | TABLE ACCESS FULL | EMP | 1 | 42 | 3 (0)|
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    1 - filter("EMPLOYEE_ID"=12)

  • Can connect using sqlplus, cannot using SQL Developer

    Hi
    I cannot find out why I cannot connect using SQL developer, while sqlplus works fine with the same login information.
    *1. TNS ping:*
    C:\>TNSPING manila
    TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 24-GRU-2
    010 13:28:38
    Copyright (c) 1997, 2005, Oracle. All rights reserved.
    Used parameter files:
    C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.171)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
    OK (370 msec)
    *2. sqlplus*
    SQL> CONNECT SULU_DEV/<pass>@MANILA
    Connected.
    *3. sqlplus - by IP*
    SQL> CONNECT SULU_DEV/<pass>@10.0.0.171:1521/XE
    Connected.
    *4. SQL Developer*
    Username: SULU_DEV
    Connection type: TNS
    Network alias: MANILA
    Error: I/O Exception: Connection reset
    *5. SQL Developer - by IP*
    Username: SULU_DEV
    Connection type: Basic
    Hostname: 10.0.0.171
    Port: 1521
    SID: xe
    Error: I/O Exception: Connection reset
    *6. SQL Developer - without username*
    Username: <blank>
    Connection type: TNS
    Network alias: MANILA
    Error: ORA-01017: invalid username/password
    It seems that I have connection to the server, but from some reason it is disconnected when I'm using SQL Developer, but works fine with sqlplus.
    Any ideas on what it might be?
    Thank you in advance,
    Regards,
    Marek

    The connection export function it's available in 2.1.1.64, you need to right click on the main Connections node, and it will allow you to export all or part of the current connections, or import from a previously exported file.
    As for the highlight statement feature it's available in SQLDeveloper; actually you do not even have to highlight the required statement, as long as you take the habit of ending every statement with a ";", in this case you only need to place the caret inside the statement and SQLDeveloper will automatically highlight it for you (if you want to manually highlight a statement you can still do so without problems).
    Finally as a last try to solve your connection problem without having to call for network support you could try to check
    Preferences -> Database -> Advanced -> Use OCI/Thick DriverThis will force SQLDeveloper to use your oracle client for connections instead of it's native JDBC based connections (even if you use TNS based connections you will still use JDBC unless you have this checked).
    As for other graphical tools for Oracle there are many both free or for a price.
    1) In the for price world Toad stands out, i heard of a free option too but I'm not sure of the limitations.
    2) For free you can use DBVisualizer which is fairly good (never used it too much thou).
    3) Finally there is SQuirreL which is both free and open source but it has fairly basic functionality compared to the two above.
    Obviously there are many others, but IMHO few will provide you with the same functions of SQLDeveloper or Toad for Oracle databases

  • Explain plan different for same query

    Hi all,
    I have a query, which basically selects some columns from a remote database view. The query is as follows:
    select * from tab1@remotedb, tab2@remotedb
    where tab1.cash_id = tab2.id
    and tab1.date = '01-JAN-2003'
    and tab2.country_code = 'GB';
    Now, i am working on two environments, one is production and other is development. Production environment has following specification:
    1. Remotedb = Oracle9i, Linux OS
    2. Database on which query is running = Oracle10g, Linux OS
    Development environment has following specification:
    1. Remotedb = Oracle10g, Windows OS
    2. Database on which query is running = Oracle10g, Linux OS
    Both databases in development and production environments are on different machines.
    when i execute the above query on production, i see full table scans on both tables in execution plan(TOAD), but when i execute the query in development, i see that both remote database tables are using index.
    Why am i getting different execution plans on both databases? is there is any difference of user rights/priviliges or there is a difference of statistics on both databases. I have checked the statistics for both tables on Production and Development databases, they are updated.
    This issue is creating a performance disaster in our Production system. Any kind of help or knowledge sharing is appreciated.
    Thank you and Best Regards.

    We ran into a similar situation yesterday morning, though our implementation was easier than yours. Different plans in development and production though both systems were 10gR2 at the time. Production was doing a Merge Join Cartesian (!) instead of nested loop joins. Our DBA figured out that the production stats had been locked for some tables preventing stat refresh; she unlocked them and re-analyzed so which fixed our problem.
    Of some interest was discovering that I got different execution plans from the same UPDATE via EXPLAIN PLAN and SQL*PLUS AUTOTRACE in development. Issue appears to have been bind peeking. Converting bind variables to constants yielded the AUTOTRACE plan, as did turning bind peeking off while using the bind variables. CURSOR_SHARING was set to EXACT too.
    Message was edited by:
    riedelme

  • Printing of Explain Plan Results

    Is there any way to print an explain plan in SQL Devveloper when the length of the plan result requires scrolling to view the entire plan. I've tried expanding the plan result window as much as possible. The print result contains only what can be viewed.

    I haven't tried DBMS_XPLAN but I'll look it up.
    I can generate explain plans in a manner that's acceptable to read by simply using SQL*Plus.
    This thread was about evaluating the features and problems with SQL*Developer. What I'm saying with this posting is that there is a problem with printing the explain plans that are generated in SQL*Developer when the plan result extend past the viewed window.
    Is there a way to send this problem with the Oracle devlopers the way we do with SRs in Metalink? I didn't know if it was appropriate to send this through Metalink. I thought Oracle was monitoring this Forum for issues that were discovered with SQL*Developer.

Maybe you are looking for