Same query runs with a lot of difference of speed on two machines

Dear All,
I am facing a strange problem.
A query which when run in SQL*Plus/Toad/Oracle SQL Developer, gives output within fraction of seconds. But when i run the same query in my home it takes about hour to produce output.
Using schema script i managed to have the same database setup at my home. My home PC is having better processor than company PC and having same memory.
In company the database server is linux and i access it using a Oracle client, but in home it is on same PC.
I am sure that i am running the same query with the same database as i had run another queries successfully on the same database.
Then how do this come?
Am i missing something? Any idea?
Do revert.
Thanks in advance.
-Sameer

Its possible that network communcations is part of what you're seeing. TOAD can wait until it gets back all the data you are querying; a lot of data could take awhile to transfer off-site. If not network it could be something else in your environment.
Try writing a PL/SQL cursor to be executed inside the database without bringing data back to the client and time it to see if merely selecting the data on the server takes a long time.

Similar Messages

  • Query on a table runs more than 45mins(after stats) and same query runs 19secs(before stats - rebuild)

    Query on a table runs more than 45mins(after stats) and same query runs 19secs(before stats - rebuild) - Not sure what the cause is.
    - Analysed the explain the plan
    - different explain plan used afterr stats gather.
    Any idea what could be the cause with this kind of difference.
    Thank you!

    What is the difference you see in the explain plan ? Where it spends most time. All these needs to be analysed.

  • Significant difference in response times for same query running on Windows client vs database server

    I have a query which is taking a long time to return the results using the Oracle client.
    When I run this query on our database server (Unix/Solaris) it completes in 80 seconds.
    When I run the same query on a Windows client it completes in 47 minutes.
    Ideally I would like to get a response time equivalent on the Windows client to what I get when running this on the database server.
    In both cases the query plans are the same.
    The query and plan is shown below :
    {code}
    SQL> explain plan
      2  set statement_id = 'SLOW'
      3  for
      4  SELECT DISTINCT /*+ FIRST_ROWS(503) */ objecttype.id_object
      5  FROM documents objecttype WHERE objecttype.id_type_definition = 'duotA9'
      6  ;
    Explained.
    SQL> select * from table(dbms_xplan.display('PLAN_TABLE','SLOW','TYPICAL'));
    PLAN_TABLE_OUTPUT
    | Id  | Operation          | Name      | Rows  | Bytes |TempSpc| Cost (%CPU)|
    |   0 | SELECT STATEMENT   |           |  2852K|    46M|       | 69851   (1)|
    |   1 |  HASH UNIQUE       |           |  2852K|    46M|   153M| 69851   (1)|
    |*  2 |   TABLE ACCESS FULL| DOCUMENTS |  2852K|    46M|       | 54063   (1)|
    {code}
    Are there are configuration changes that can be done on the Oracle client or database to improve the response times for the query when it is running from the client?
    The version on the database server is 10.2.0.1.0
    The version of the oracle client is also 10.2.0.1.0
    I am happy to provide any further information if required.
    Thank you in advance.

    I have a query which is taking a long time to return the results using the Oracle client.
    When I run this query on our database server (Unix/Solaris) it completes in 80 seconds.
    When I run the same query on a Windows client it completes in 47 minutes.
    There are NO queries that 'run' on a client. Queries ALWAYS run within the database server.
    A client can choose when to FETCH query results. In sql developer (or toad) I can choose to get 10 rows at a time. Until I choose to get the next set of 10 rows NO rows will be returned from the server to the client; That query might NEVER complete.
    You may get the same results depending on the client you are using. Post your question in a forum for whatever client you are using.

  • Why same query runs on isqlplus but not in Forms/Reports trigger

    Hi,
    I have one query in which I extract one column with parent table join if I run same query on isqlplus prompt it works but if I run same on Forms/Reports trigger it says found "select" where something else expected.
    below is an example .
    select em1.mreading, em1.grid_code,
    (select em.mreading from energy_mreading em where em.grid_code=em1.grid_code and em.transformer_code=em1.transformer_code
    and em.bus_bar=em1.bus_bar and to_date(to_char(em.r_date,'dd/mm/yyyy'),'dd/mm/yy') = to_date('02/01/07' ,'dd/mm/yy') - 1)
    as Yreading
    from energy_mreading em1
    where to_date(to_char(em1.r_date,'dd/mm/yyyy'),'dd/mm/yy')= to_date('02/01/07' ,'dd/mm/yy')
    Any one can help me, is there any restriction/limitations in Forms/Reports triggers.
    Thanks, Khawar.

    In forms and cursors you can not use scalar subqueries as you do. You have to use joins!
    select
         em1.mreading
        ,em1.grid_code
        ,em.mreading as Yreading
    from
        energy_mreading em1
       ,energy_mreading em
    where 1=1
        and trunc(em1.r_date) = to_date('02/01/2007','dd/mm/rrrr')
        and em.grid_code = em1.grid_code
        and em.transformer_code = em1.transformer_code
        and em.bus_bar = em1.bus_bar
        and trunc(em.r_date) = trunc(em1.r_date) - 1
    Try this, hope it works.

  • Two different Resultsets for the same query (running at the same time)

    I am using the Thin Driver for Oracle 8.1.6. I am invoking queries in multithreading mode (each thread has his own connection to the oracle DB). If i am invoking the same SQL-Statement in two different threads nearly at the same time, only the ResultSet of the first query is complete. The ResultSet of the second query is not complete (the number of tuples differs each time I run the program). Principally the two ResultSets should be the same (no changes are done at the same time in the DB), but they are not.
    Anybody knows this problem and knows how to solve it? Principally read accesses on DBs should not make such trouble ...
    I hope anybody can help me.

    Pranav,
    As this BADI is having option checked 'Multiple use'. You can implement multiple implementations.
    You need not to deactivate the existing implementation.
    Reddy

  • Huge difference in Execution time in same Query with different Parameter

    Hi Experts,
    We are facing an unique problem once we are executing the query in HANA SQL prompt. This Query was generated from BObj and executing in HANA system. Once this query running with following condition, it is taking almost 7-00 minute to execute and returning around 924 rows.
    << WHERE
    Table__1."LOGSYS"  IN  ('RKGCLNT102')
    AND
    Table__1."CompanyCode"  IN  ('7240','7245')
    AND
    Table__1."Plant"  IN ……………… >
    However if we run the same query with some different plant, It is taking only 2 second. Please find the Query here.
    << WHERE
    Table__1."LOGSYS"  IN  ('RKGCLNT102')
    AND
    Table__1."CompanyCode"  IN  ('7245','7600')
    AND
    Table__1."Plant"  IN ……………… >
    This is really an unexpected behavior and we are not able to get the actual reason why it is behaving like this.
    Could anyone please help to analyze this issue to fine the root cause.
    Thanks in Advance.
    Regards
    Satrajit.

    Hi there
    Unfortunately you provided too few information to analyze the issue.
    Maybe the underlying tables have very skew data and the first select has to read a larger share of the base tables.
    Maybe the columns had been unloaded before and the first query had to load them into memory first.
    Is the runtime always bad with the one and always good with the other set of parameters?
    Have you checked the PlanViz for both versions? How do these differ?
    - Lars

  • Query takes longer to run with indexes.

    Here is my situation. I had a query which I use to run in Production (oracle 9.2.0.5) and Reporting database (9.2.0.3). The time taken to run in both databases was almost the same until 2 months ago which was about 2 minutes. Now in production the query does not run at all where as in Reporting it continues to run in about 2 minutes. Some of the things I obsevred in P are 1) the optimizer_index_cost_adj parameter was changed to 20 from 100 in order to improve the performance of a paycalc program about 3 months ago. Even with this parameter being set to 20, the query use to run in 2 minutes until 2 months ago. in the last two months the GL table increased in size from 25 million rows to 27 million rows. With optimizer_index_cost_adj of 20 and Gl table of 25 million rows it runs fine, but with 27 million rows it does not run at all. If I change the value of optimizer_index_cost_adj to 100 then the query runs with 27 million rows in 2 minutes and I found that it uses full table scan. In Reporting database it always used full table sacn as found thru explain plan. CBO determines which scan is best and it uses that. So my question is that by making optimizer_index_cost_adj = 20, does oracle forces it to use index scan when the table size is 27 million rows? Isn't the index scan is not faster than full table scan? In what situation the full table scan is faster than index scan? If I drop all the indexes on the GL table then the query runs faster in production as it uses full table scan. What is the real benefit of changing optimizer_index_cost_adj values? Any input is most welcome.

    Isn't the index scan is not faster than full table scan? In what situation the full table scan is faster than index scan? No. It is not about which one is the "+fastest+" as that concept is flawed. How can an index be "faster" than a table for example? Does it have better tires and shinier paint job? ;-)
    It is about the amount of I/O that the database needs to perform in order to use that object's contents for resolving/executing that applicable SQL statement.
    If the CBO determines that it needs a 100 widgets worth of I/O to scan the index, and then another 100 widgets of I/O to scan the table, it may decide to not use the index at all, as a full table scan will cost only a 180 I/O widgets - 20 less than the combined scanning of index and table.
    Also, a full scan can make use of multi-block reads - and this, on most storage/file systems, is faster than single block reads.
    So no - a full table scan is NOT a Bad Thing (tm) and not an indicator of a problem. The thing that is of concern is the amount of I/O. The more I/O, the slower the operation. So obviously, we want to make sure that we design SQL that requires the minimal amount of I/O, design a database that support minimal I/O to find the required data (using clusters/partitions/IOTs/indexes/etc), and then check that the CBO also follows suit (which can be the complex bit).
    But before questioning the CBO, first question your code and design - and whether or not they provide the optimal (smallest) I/O footprint for the job at hand.

  • SQL Server 2012 Physical vs. Hyper-V Same Query Different Results

    I have a database that is on physical hardware (16 CPU's, 32GB Ram).
    I have a copy of the database that was attached to a virtual Hyper-V server (16 CPU's, 32GB Ram).
    Both Servers and SQL Servers are identical OS=2008R2 Standard, SQL Server 2012R2 Standard same patch level SP1 CU8.
    Same query run on both servers return same data set, but the time is much different 26 Sec on Physical, 5 minutes on virtual.
    Statistics are identical on both databases, query execution plane is identical on both queries.
    Indices are identical on both databases.
    When I use set statistics IO, I get different results between the two servers.
    One table in particular (366k rows) on physical shows logical reads of 15400, on Hyper-V reports logical reads of 418,000,000 that is four hundred eighteen million for the same table.
    When the query is run on the physical it uses no CPU, when run on the Hyper-V it takes 100% of all 16 processors.
    I have experimented with Maxdop and it does exactly what it should by limiting processors but it doesn't fix the issue.

    A massive difference in logical reads usually hints at differences in the query plan.
    When you compare query plans, it is essential that you look at actual query plans.
    Please note that if your server / Hyper-V supports parallelism (which is almost always nowadays), then you are likely to have two query plans: a parallel and a serial query plan. Of course the actual query plan will make clear which one is used in which
    case.
    To say this again, this is by far the most likely reason for your problem.
    There are other (unlikely) reasons that could be the case here:
    runaway parallel threads or other bugs in the optimizer or engine. Make sure you have installed the latest service pack
    Maybe the slow server (Hyper-V) has extreme fragmentation in the relevant tables
    As mentioned by Erland, you have much much more information about the query and query plan than we do. You already know whether or not parallelism is used, how many threads are being used in it, if you have no, one or several Loop Joins in the query (my
    bet is on at least one, possibly more), etc. etc.
    With the limited information you can share (or choose to share), involving PSS is probably your best course of action.
    Gert-Jan

  • Same query at same time, but different execution plans from two schemas

    Hi!
    We just had some performance problems in our production system and I would like to ask for some advice from you.
    We had a select-query that was run from USER1 on SCHEMA1, and it ran a table scan on a huge table.
    Using session browser in TOAD I copied the Sql-statement, logged on SCHEMA1 and ran the same query. I got a different execution plan where I avoided the table scan.
    So my question is:
    How is it possible that the same query get different execution plans when running in two different schemas at the same time.
    Some more information:
    The user USER1 runs "alter session set current_schema=SCHEMA1;" when it logs on. Besides that it doesn't do anything so session parameter values are the same for USER1 and SCHEMA1.
    SCHEMA1 is the schema owning the tables.
    ALL_ROWS is used for both USER1 and SCHEMA1
    Our database:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE     9.2.0.8.0     Production
    TNS for Linux: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production
    Anybody has some suggestions to why I experience different execution plan for the same query, run at the same time, but from different users?

    Thanks for clarification of the schema structure.
    What happens if instead of setting the current session schema to SCHEMA1, if you simply add the schema name to alle tables, views and other objects inside your select statement?
    As in select * from schema1.dual;I know that this is not what you want eventually, but it might help to find any misleading objects.
    Furthermore it is not clear what you meant with: "avoided a table scan".
    Did you avoid a full table scan (FTS) or was the table completely removed from the execution plan?
    Can you post both plans?
    Edited by: Sven W. on Mar 30, 2010 5:27 PM

  • Abnormal, Same query get data in sql but not working on Fron-end

    Dear,
    Version :Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    We have created packed in oracle database befor two months ago & was working fine, but since morning select statment in package is not working while running via application which mentioned below and raise not data found but surprising thing is that same query is getting data when we execut on sql plus return one record.
    i don't know either it's abnormal behaviour or sth else becuase the same query run without changing any singl column in where_clause work in sql but not getting data while submition request through oracle application and raising not data found.
    --thankse
    Edited by: oracle0282 on Dec 29, 2011 2:20 AM

    Actully when i run this query in sql it return one record on the same parameter, while when we exeucte this select in pl/sql on the same parameter oracle raise no data found error.
    so i got confused the same query with same parameter retur record in sql but when we call it fron-end through packege raise 'no data found error'.
    hope you understand now.
    --thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • What causes ad-hoc to run with bad plan and its resolution

    One of our Company Application funcnalities uses the ad-hoc query that returns top first row from the result sets .There has been several times since this ad-hoc query ran with a bad
    execution in last 8 months .There is no specifice time and date or day when this query run with bad execution plan ,however whenever this query ran with a bad execution plan on SQL ,that happed always early in the morning , before 6am .The setting of database
    parameterization is set to forced .There is SQL maintenance reindexing job that runs each night at 2am that changes the recovedry model of our production database from Full to simple and changing back from simple to full after the reindexing operation .That
    causes the SQL plans to flush each night .The next day morning , when the application ad-hoc query runs on SQL first time , SQL generates a new plan for that query . Some strange reason , SQL genarates a good plan for that ad-hoc query most of the times ,but
    sometime this query picks up a bad plan .Whenever it happen,the application function becomes exetremly slow and it seems that the rest of the fuctionalities work fine meantime .
    Our application vender is aware of this issue and this issue will be fixed in the application next release .Developer is converting the ad-hoc query into stored procedure to fix this
    issue .Application new relase will not available for next 2-3 months ,meantime we still have to deal with the ad-hoc query bad execution plan issue . Usually ,when the ad-hoc query run with the bad execution plan , I retrieve the query bad plan and just remove
    the plan for that particular query from cache .Once the bad plan is removed from cache , the perfomance gets back to normal .
    As my understanding, this issue is related to parameter sniffing .but anyone thinks there are other factors responsible for this issue such as the network problem , the resource intensive
    report ran or something else .
    Has anyone have step by step troubleshooting steps that could help me with my investigation and what areas
     do I need to look into in order to investigate what could caused the ad-hoc query to pick up bad plan ?
    Any help will be apprecited .
    Daizy

    When we upgraded our Production Database to SQL server 2008R2 enterprise Edition. We ran into the transaction log file to grow too large during the reindexing job activities at night .To prevent the transaction log file to grow big , we had decided to change
    the recovery model of database from FULL to Simple before the reindexing job starts and the recovery model of Database is changed from Simple to Full after the reindexing job finishes . We also have the differential backup job setup right after the recovery
    model change back to full so the transaction log backup chain does not break.
    The transaction log chain breaks when you set the recovery to simple.
    Yes, if you take a diff backup, you can apply transaction logs from that point
    if the diff backup is good. If the diff backup is bad, you will lose all updates after you set recovery to simple. And, yes, when you hardware starts to deteoriate, you should not be surprise that the last backup is not good.
    Again, please stop setting recovery to simple, unless you have a very relaxed RPO in your SLA. Use bulk-logged recovery instead.
    By the way, you do take a t-log backup before you change the recovery mode, don't you?
     Changing the database recovery model does flush the SQL plans for specific Database. Please review this linkhttp://sqlblogcasts.com/blogs/steveh/archive/2010/09/02/changing-recovery-model-removes-plans-from-procedure-cache-for-a-database.aspx
    Hmmm. I don't have the time to verify this right now. Anyway, reindexing is good enough to flush the cache of most plans.
    I have pretty much all required info regarding this query , but what other areas or investigation do I need to do for the query parameter sniffing issue ?
    Have you researched what values the initial plan is sniffed for?
    As Erland said  adding space in query ,I don?t know adding space means just add additional space in the query so it hashes a different values .Please advice .
    Obviously, you need access to the application code. The other alternative is to set up an early morning job that runs after this first execution and which forces a recompilation; either by evicting this specific plan or more brutally runs sp_recompile on
    one of the tables in the query.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Same query different languange

    Hi All,
    How to maintain same query but with different language i.e English and German. Is there a dictionary to maintain for the translation or is it auto-translate.
    Appreciate any inputs.
    Points for all help.
    Thanks and regard.
    Azlan

    Hi,
    in case you have all headlines.... as variables and you are not using any fixed texts in your query this will be done automatically in case you translated all stuff. Mostly the standard objects are coming with german and english anyway ...
    For the translation use rsa1->goto->translation.
    regards
    Siggi

  • After updating iTunes 10.5 and iPhone 4 iOS 5 my phone doesn't work at all.  It freezes while it is trying to do the Restore phone.  That means I have not have a functional phone for two days now.  Same thing happens with my iPad 2.

    I updated Itunes to v 10.5.  Mistake!!!!  Then updated iOS 5 to my iPhone 4 now my iPhone doesn't work as the applications freezes when trying to restore the phone.  Same thing happens with my iPad 2, so now I have two pieces of equipment that are completely non-functional.  Can any please tell me what to do?  How can I reinstall the previous versions of iTunes, or iOS which were working on my iPhone and on my iPad?  I hate iTunes and this has been the last drop that messed up my equipment.  Please help me.  I do not have another phone to call APPLE.  This ***** big time!! PLEASE HELP ME!!!

    Connect to a computer to restore.

  • Multiple sheets with the same query automaticly

    Hi gurus,
    I want to create a workbook with one query and one input variable.
    The input variable is the 0PLANT. And I want to execute the same query so many times as  0PLANPLANTs has the 0PLANT and each 0PLANPLANT appear in different sheets.
    There are different 0PLANTs with 4,5,6,... 0PLANPLANTs and the workbook has to be valid to all 0PLANT and automaticly generate 4,5,6,... sheets depending of the number of 0PLANPLANTs has the 0PLANT.
    Any idea?
    Best regards

    But, what macros? I don´t have idea over macros excel´s.
    Thanks for your answer.

  • I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build.  The same call works fine when running on the device

    I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build. The same call works fine when running on the device (iPhone) using debug build. When running with a release build, the result handler is never called (nor is the fault handler called). Viewing the BlazeDS logs in debug mode, the call is received and send back with data. I've narrowed it down to what seems to be a data size issue.
    I have targeted one specific data call that returns in the String value a string length of 44kb, which fails in the release build (result or fault handler never called), but the result handler is called as expected in debug build. When I do not populate the String value (in server side Java code) on the object (just set it empty string), the result handler is then called, and the object is returned (release build).
    The custom object being returned in the call is a very a simple object, with getters/setters for simple types boolean, int, String, and one org.23c.dom.Document type. This same object type is used on other other RemoteObject calls (different data) and works fine (release and debug builds). I originally was returning as a Document, but, just to make sure this wasn't the problem, changed the value to be returned to a String, just to rule out XML/Dom issues in serialization.
    I don't understand 1) why the release build vs. debug build behavior is different for a RemoteObject call, 2) why the calls work in debug build when sending over a somewhat large (but, not unreasonable) amount of data in a String object, but not in release build.
    I have't tried to find out exactly where the failure point in size is, but, not sure that's even relevant, since 44kb isn't an unreasonable size to expect.
    By turning on the Debug mode in BlazeDS, I can see the object and it's attributes being serialized and everything looks good there. The calls are received and processed appropriately in BlazeDS for both debug and release build testing.
    Anyone have an idea on other things to try to debug/resolve this?
    Platform testing is BlazeDS 4, Flashbuilder 4.7, Websphere 8 server, iPhone (iOS 7.1.2). Tried using multiple Flex SDK's 4.12 to the latest 4.13, with no change in behavior.
    Thanks!

    After a week's worth of debugging, I found the issue.
    The Java type returned from the call was defined as ArrayList.  Changing it to List resolved the problem.
    I'm not sure why ArrayList isn't a valid return type, I've been looking at the Adobe docs, and still can't see why this isn't valid.  And, why it works in Debug mode and not in Release build is even stranger.  Maybe someone can shed some light on the logic here to me.

Maybe you are looking for

  • Why am I getting flooded with calls from a deactivated verizon wireless number?

    Im not a verizon customer, but after spending several hours on the phone with their customer support to no avail, Im turning to the community for help. The past two days Ive been flooded with calls from verizon wireless numbers in MO (mostly 636 area

  • How do I get the Serial Number for Adobe XI that purchased from Amazon over two weeks ago?

    I am trying to get the serial number so that I can have the permanent version of the Adobe XI that I purchased from Amazon.  Does anybody know how Adobe alerts a buyer to this info?  I purchased the software as a Download so do not have a box.

  • Mavericks and Beachballs

    I'd like to advise Apple of an issue. Is the Apple Support Communities the best method? I have a 2011 circa MacBookPro 2.2 GHz intel i7, Radeon HD 6750M, 4GB RAM. It originally came with Mac)S 10.7 (I believe), after upgrading to MacOS 10.8 I saw a l

  • I18n Struts Jco Code in Windows English and Polish System

    I am working on Struts ,SAP-JCO . This is i18n application running on Tomcat. I have designed my application in UTF8 charset. When Saving the polish characters from application they are saved into SAP Database properly. Before Saving i am doing follo

  • Importing files that do not need transcoding?

    Just curious about the process. I import XDCAM EX files that do not require transcoding. As a matter of fact the option is not available. And that is fine, very few problems. But here is what I don't understand. FCP X needs ProRes to operate efficien