To cache the query?

Here's what I'm trying to do:

I have a database where I display information in a table - on every column, there is the possibility to order asc or desc. It works by using a switch statement to change the order. Now, recently I added filtering options, and it works very well, too using a cfif to change the WHERE clause in the query.

My problem is that once the page reloads with the new filtered information, my asc, desc does not work with the filtered options - instead, it reloads the page captures ALL the records and then up or down. Should I be caching the query? Or y at - it another way to ASC and desc? Thanks for any help - let me know if I need to add more information.

creelove,

Which application are you trying to cache? There are several requests in the example code PDF and I know you mentioned that you have changed the code a little, but I'm guessing that queries are similarly structured in your conditional statements (suggestion on that below).

If it's the cfquery named "qry_record" that you want to cache, which is going to be a problem. To cache a query (unless this has changed in CF 8, I have not checked), the query must be * exactly * the same thing.

This query:

Select * from table where itemA = "#itemA #

Is this not the same (in terms of caching) as this query:

Select * from table where itemB = "#itemB #

Without the "corresponding" queries, caching does not work as expected.

Another thing I noticed is that your (hidden field) is not using a dynamic value is always Yes. Don't know if that could lead to a question for you, but thought I'd call it (because you pass a key/value in the URL for 'filter').

Given the code, variable were you trying to store in the scope of the session and how you were (it was not in the code example, unless I missed it!)?

The application of qry_record:

It's just a suggestion, and what you have is not bad, please disregard if you wish.

You are repeated several times the qry_record in your code and you could do just a single shot (which a little easier for you to read and to debug the code). The application of qry_record in the respective conditional block, is the same in all cases, except for the place where clause:

Select *.

from the data. WF_Masterview2

^^ When x = y ^^

order by = #orderby #.

You can configure the part WHERE your query in the conditional block, and then type the query once at the end (a bit like what you're doing when you set the orderby variable):

Col = 'itemA.

Val = #itemA #.

Col = 'itemB.

Val = #itemB #.

Col = 'itemC.

Val = #itemC #.

Col = 'itemA.

Val = #itemA #.

After this conditional block is running, you can run the query:

select *

from data.WF_Masterview2

where #col# = '#val#'

order by = #orderby#

name=" "="">

Tags: ColdFusion

Similar Questions

  • The query results cached?

    Hi guys,.

    I have this page that calls the same query (on a database link!) four times! First when an initial LOV is generated (and the page loads), again for an another LOV based on the original and finally for the generated report based on the 2 selections. It's insanely slow (30-40 seconds on each load ~) and also: when you try to sort a report interactive by clicking on the column name, and then queries the database again (I assumed that this part has been cached but apparently not). I so need to caching the results of an initial request and then just limit the results locally. How can I do this? Guides? Examples?

    Thanks for help.

    Mike

    I tried this example based on a view:

    CREATE MATERIALIZED VIEW MV_TEST2
         REFRESH COMPLETE
         START WITH SYSDATE
         NEXT  SYSDATE + 1/48
         WITH ROWID
         AS SELECT * FROM test1;
    

    DISCOUNT COMPLETE - The complete refresh recreates together materialized view.
    START WITH SYSDATE - run now
    NEXT SYSDATE + 1/48 - run again in half an hour
    WITH ROWID - I think that this option is important if you are using a partial refresh of the view.
    AS SELECT * FROM test1; -test1 is a point of view:

    CREATE OR REPLACE VIEW TEST1 AS
    SELECT st_id, st_name
        FROM aaw_solution_tree;
    

    Index of the column are still possible? I do not know:
    Indexing:! in regards to the MV about 10 gr 2 Jonathan Lewis wrote. ... you are allowed to create indexes on tables that sit under materialized views - just don't make them unique indexes

    How much freedom is there to set the refresh rate?
    What kind of discount do you need?

    Another useful link: [http://asktom.oracle.com/pls/ask/search?p_string=materialized+view | http://asktom.oracle.com/pls/ask/search?p_string=materialized+view]

    It will be useful.

    Tobias

  • The effectiveness of the query is not stable.

    Hello

    I create an index on a field, then I execute a query operation that goes from 155 seconds by the table API.

    A few minutes later, I run the same operation with the same query conditions, passing 6 seconds!

    If I continue to run the same query operation, the time spent will be stable in 6 seconds.

    The same situation also occurred when I run the query using the CLI operation.

    What are the causes it to happen? I think that it is strange and interesting.

    Servers such as database servers are long running and so the cache is normally cold. In order to test the performance of queries when the cache is cold, it is not the normal case. Tests, if the cache is hot is usually more relevant.

    I suggest that you take a step back and ask, what is your goal as part of these tests.

    -mark

  • cached SQL query?

    Hello, when the 11 GR 2. run a select package.f_function ('STRING') of double) as a subquery, that subquery runs only the first initial, and then every other time, if the main application is in the loop, is run from the cache? The CHAIN will be the same and is placed as a constant, it is not variable binding. But I doubt he is read from the cache because it is a within a SQL PL, am I correct?

    If you ask about the caching of scalar subquery in Oracle - Yes Oracle can cache the result (no DETERMINISTIC or RESULT_CACHE) when the function is called a SELECT query. But there is a method or a way to do it. Read the Blog of Tom Kyte: yet another new...  and http://www.oracle.com/technetwork/issue-archive/2011/11-sep/o51asktom-453438.html

    to see some examples.

  • Internal XML to the query with join

    I have a CF page that reads an XML file in a query using < cffile > XMLParse and QueryAddrow.

    I then do a QoQ on the result and voila! I have my page.  I hide the query for 8 hours and the XML file is only reread this cache expires.  It works well.

    My problem now is that the file contains data from three tables of database instead of one, so I need to make an inner join on the tables.  But I can't do a t/t with an inner join.

    Does anyone know a way for me to do this?

    Oh, didn't know that.  How about interweaving of QofQ?  Join Query1 and Query2 requests in a new query, then join for 3 statement?

  • Should I wait until the end of the execution time of the query for the execution plan?

    Hello Experts,

    I want to see the execution plan of the query below. However, it takes more than 3 hours. Should I wait all the time to see the execution plan?

    Note: EXPLAIN PLAN for does not work. (I mean that I do not see the actual line number, etc. with EXPLAIN the PLAN of market)

    You can see the output of the execution plan when I canceled the execution after 1 minute.

    My first question is: what should I do to see the execution plan for queries running out of time time?

    2nd question: when I cancel the query during execution in order to see the execution plan, will I see the specific plan of execution or erroneous values? Because the first execution plan seems inaccurate, what do you think?

    question 3: why EXPLAIN the PLAN for the clause does not work? Also, should I use EXPLAIN the PLAN of the clause to this scenerio? Can I see the result of running for long time without her queries?

    Thnaks for your help.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    PL/SQL Release 11.2.0.2.0 - Production

    CORE Production 11.2.0.2.0

    AMT for Linux: Version 11.2.0.2.0 - Production

    NLSRTL Version 11.2.0.2.0 - Production

    Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price

    of custinvoicejour j join custinvoicetrans t on

    substr (nls_lower (j.DataAreaId), 1, 7) = substr (nls_lower (t.dataareaid), 1, 7) and

    substr (nls_lower (J.INVOICEID), 1: 25) = substr (nls_lower (t.INVOICEID), 1: 25)

    where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM = 29457

    and substr (nls_lower (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in

    (select IT. Drmpos.avtr_seg_cust_campend ACCOUNTNUM this where THIS. CAMPAIGN = '201406' and THIS. SEGMENT_LEVEL in (', 'E'))

    and J.AVAWARDSALES > 190

    and substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406'

    "and J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 ';

    SQL_ID, dznya6x7st0t8, number of children 0

    -------------------------------------

    Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT,.

    J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price of

    CustInvoiceJour j join custinvoicetrans t on

    substr (nls_lower (j.DataAreaId), 1, 7) =

    substr (nls_lower (t.DataAreaId), 1, 7) and

    = substr (nls_lower (J.INVOICEID), 1: 25)

    substr (nls_lower (t.INVOICEID), 1: 25) where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM =

    29457 and substr (nls_lower, (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in (select CE. ACCOUNTNUM of

    drmpos.avtr_seg_cust_campend this where THIS. CAMPAIGN = '201406' and

    IT. SEGMENT_LEVEL in (', 'E')) and J.AVAWARDSALES > 190 and

    substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406' and

    "J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 '.

    Hash value of plan: 2002317666

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name                           | Begins | E - lines. A - lines.   A - time | Pads | Bed |  OMem |  1Mem | Used Mem.

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |                                |      1.        |      0 | 00:00:00.01 |       0 |      0 |       |       |          |

    |*  1 |  HASH JOIN |                                |      1.   3956.      0 | 00:00:00.01 |       0 |      0 |  2254K |  1061K | 2190K (0) |

    |*  2 |   HASH JOIN |                                |      1.     87.  16676. 00:00:01.64 |     227K |   3552.  3109K |  1106K | 4111K (0) |

    |*  3 |    TABLE ACCESS BY INDEX ROWID | CUSTINVOICEJOUR |      1.   1155 |  31889 | 00:00:01.16 |     223KO |     15.       |       |          |

    |*  4 |     INDEX RANGE SCAN | I_062INVOICEDATEORDERTYPEIDX |      1.   4943 |    134K | 00:00:00.83 |   45440 |      0 |       |       |          |

    |   5.    SIMPLE LIST OF PARTITION.                                |      1.  82360 |    173K | 00:00:00.08 |    3809 |   3537 |       |       |          |

    |*  6 |     TABLE ACCESS FULL | AVTR_SEG_CUST_CAMPEND |      1.  82360 |    173K | 00:00:00.06 |    3809 |   3537 |       |       |          |

    |   7.   TABLE ACCESS BY INDEX ROWID | CUSTINVOICETRANS |      1.   4560 |      0 | 00:00:00.01 |       0 |      0 |       |       |          |

    |*  8 |    INDEX RANGE SCAN | I_064INVLINENUMCAMPAIGNOFPRICE |      1.   4560 |      0 | 00:00:00.01 |       0 |      0 |       |       |          |

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    1 - access("J".") "SYS_NC00299$"="T". "' SYS_NC00165$ ' AND SUBSTR (NLS_LOWER ('J'. "" "" REFFACTURE")(, 1, 25) = SUBSTR (NLS_LOWER ("T"." "" "REFFACTURE")(, 1, 25)).

    2 - access("J".") INVOICEACCOUNT '= SYS_OP_C2C ("EC". ". ACCOUNTNUM'))

    3 - filter("J".") AVAWARDSALES"> 190)

    4 - access("J".") SYS_NC00299$ "= U ' 201"AND "J". INVOICEDATE"> = TO_DATE(' 2014-06-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND

    "J"." SYS_NC00307$ "= U ' 201406"AND "J". INVOICEDATE"< = TO_DATE (' 2014-06-13 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')))

    filter ((' J'. "INVOICEDATE' > = 'J' AND TO_DATE(' 2014-06-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') '." " SYS_NC00307$ "= U '201406' AND"

    "J"." INVOICEDATE"< = TO_DATE (' 2014-06-13 00:00:00 ',' syyyy-mm-dd hh24:mi:ss'))))

    6 filter (("CE". "SEGMENT_LEVEL" = A "OR"THIS"." SEGMENT_LEVEL "=" E"))

    8 - access("T".") SYS_NC00165$ "= U ' 201"AND "T". AVBROCHURELINENUM "= 29457)

    filter ("T". ("AVBROCHURELINENUM" = 29457)

    EXPLAIN PLAN FOR

    Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price

    of custinvoicejour j join custinvoicetrans t on

    substr (nls_lower (j.DataAreaId), 1, 7) = substr (nls_lower (t.dataareaid), 1, 7) and

    substr (nls_lower (J.INVOICEID), 1: 25) = substr (nls_lower (t.INVOICEID), 1: 25)

    where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM = 29457

    and substr (nls_lower (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in

    (select IT. Drmpos.avtr_seg_cust_campend ACCOUNTNUM this where THIS. CAMPAIGN = '201406' and THIS. SEGMENT_LEVEL in (', 'E'))

    and J.AVAWARDSALES > 190

    and substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406'

    "and J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 ';

    SELECT * FROM table (DBMS_XPLAN. DISPLAY_CURSOR);

    SELECT * FROM table (DBMS_XPLAN. DISPLAY_CURSOR ('7h1nbzqjgwsp7', 2));

    SQL_ID, 7h1nbzqjgwsp7, number of children 2

    EXPLAIN PLAN for select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * /.

    J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE,

    (T.LINEAMOUNT + T.LINEAMOUNTTAX) join price j custinvoicejour

    CustInvoiceTrans t on substr (nls_lower (j.dataareaid), 1, 7) =

    substr (nls_lower (t.DataAreaId), 1, 7) and

    = substr (nls_lower (J.INVOICEID), 1: 25)

    substr (nls_lower (t.INVOICEID), 1: 25) where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM =

    29457 and substr (nls_lower, (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in (select CE. ACCOUNTNUM of

    drmpos.avtr_seg_cust_campend this where THIS. CAMPAIGN = '201406' and

    IT. SEGMENT_LEVEL in (', 'E')) and J.AVAWARDSALES > 190 and

    substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406' and

    "J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 '.

    NOTE: cannot fetch SQL_ID plan: 7h1nbzqjgwsp7, CHILD_NUMBER: 2

    Check the value of SQL_ID and CHILD_NUMBER;

    It could also be that the plan is no longer in the cursor cache (check v$ sql_plan)

    NightWing wrote:

    Randolf,

    I don't understand. What you hear from the above statement that you mean A-lines and E will be incorrect, but the ratio between them remain the same. Therefore, you can deduct the bad things by comparing the differences.

    Thus, A-lines always give a wrong result for cancellation of queries, isn't it?

    Charlie,

    I think that Martin gave a good explanation. Here's another example that hopefully makes more obvious things:

    17:56:55 SQL >-things go very wrong here with a small buffer cache

    17:56:55 SQL >-T2 lines are badly scattered when you access through T1. FK

    17:56:55 SQL >--

    17:56:55 SQL >-"Small job" approach would have been a good idea

    17:56:55 SQL >-if the estimate of 100 iterations of the loop was correct!

    17:56:55 SQL > select

    17:56:55 (t2.attr2) count 2

    17:56:55 3 of

    17:56:55 4 t1

    17:56:55 5, t2

    17:56:55 6 where

    17:56:55   7  /*------------------*/

    17:56:55 8 trunc (t1.attr1) = 1

    17:56:55 9 and trunc (t1.attr2) = 1

    17:56:55 10 / *-* /.

    17:56:55 11 and t1.fk = t2.id

    17:56:55 12.

    T1

    *

    ERROR on line 4:

    ORA-01013: user has requested the cancellation of the current operation

    Elapsed time: 00:04:58.30

    18:01:53 SQL >

    18:01:53 SQL > @xplan_extended_display_cursor ' ' ' ' 'ALLSTATS LAST + COST.

    18:01:53 SQL > set echo off verify off termout off

    SQL_ID, 353msax56jvvp, number of children 0

    -------------------------------------

    SELECT count (t2.attr2) from t1, t2 where

    / / *-* trunc (t1.attr1) = 1 and

    trunc (T1.attr2) = 1 / *-* / and t1.fk = t2.id

    Hash value of plan: 2900488714

    ------------------------------------------------------------------------------------------------------------------------------------

    | ID | The NEST | DSB | Operation | Name | Begins | E - lines. Cost (% CPU). A - lines.   A - time | Pads | Bed |

    ------------------------------------------------------------------------------------------------------------------------------------

    |   0 |     |   7. SELECT STATEMENT |        |      1.        |  4999 (100) |      0 | 00:00:00.01 |       0 |      0 |

    |   1.   0 |   8 2 GLOBAL TRI |        |      1.      1.            |      0 | 00:00:00.01 |       0 |      0 |

    |   2.   1.   5.   NESTED LOOPS |        |      1.        |            |  57516 | 00:04:58.26 |     173K |  30770 |

    |   3.   2.   3.    NESTED LOOPS |        |      1.    100.  4999 (1) |  57516 | 00:00:21.06 |     116K |   3632.

    |*  4 |   3.   1.     TABLE ACCESS FULL | T1 |      1.    100.  4799 (1) |  57516 | 00:00:00.19 |    1008 |   1087 |

    |*  5 |   3.   2.     INDEX UNIQUE SCAN | T2_IDX |  57516 |      1.     1 (0) |  57516 | 00:00:20.82 |     115K |   2545 |

    |   8 2 2 |   4.    TABLE ACCESS BY INDEX ROWID | T2 |  57516 |      1.     2 (0) |  57516 | 00:04:37.14 |   57516 |  27138 |

    ------------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    4 filter ((TRUNC ('T1'. "ATTR1") = 1 AND TRUNC ('T1'. " ATTR2') = 1))

    5 - access("T1".") FK '= 'T2'.' (ID')

    You say here that I canceled a query after about 5 minutes, and looking at the statistics of content (RowSource) I can already say the following:

    1. the estimation of cardinality of T1 is far - the optimizer estimated 100 lines, but it actually generated more than 57000 lines when the query was cancelled. If this definitely seems like a candidate at the origin of the problems

    2. the query has spent most of the time in search of random table T2

    So while it is true that I don't know final A-lines of this cancelled query information, I can still say a lot of this and begin to deal with the problems identified so far.

    Randolf

  • Look up values in the query are retained when a query Panel is used in popup

    We used a panel of popup for the search request. When popup is opened again, the search criteria previous values are preserved. They may not get deleted if pop up attribute of content delivery is lazy not cached. Is it possible to clear these values or is this a bug of frame work?

    This is normal and expected behavior. The query pattern keeps the criteria values, otherwise the query Panel would be empty if you refresh the it by PPR. Depending on the configuration of the ViewCriteria and research underlying link, values can be retained even if you leave the page, and then open the page again.

    If you want to clear the query criteria when you open the context menu, you can implement a PopupFetchListener for the popup. PopupFetchListener runs every time when the popup is open. Here, you can get and to reset the component query programmatically. Check out this blogpost for more details how to reset:

    Binary: Reset and table of search results programmatically

    Dimitar

  • NoAvailableServersException when you run the query in applications

    I only run the UI applications connected to a carrier co-located in my distributed system. When I run a query of the applications I have a NoAvailableServersException. The trace of the full stack of the applications log is below. I can run the same query successfully in gfsh on the same machine, the I'm running the applications. I' wvv looked through the applications documentation but can't find problems with my setup. Please let me know if you need more information.

    Tom

    [06/02/2013 INFO 17:39:19.135 IS main] Manual applications path is C:\vmware\vfabric-gemfire\vFabric_GemFire_70_b38623\tools\DataBrowser\docs\index.html
    [06/02/2013 INFO 17:39:19.512 IS main] Start interviewing for the results link to JMX Manager operation.
    [17:39:19.692 JMXCallExecutorThread IS SERIOUS 2013/02/06] An exception occurred while connecting to the mark on the host: idcprdgflocator2.carecorenational.com and port: 1099: com.gemstone.gemfire.management.ManagementException: Locator has failed. It is normal if the index was arrested. If it wasn't not check his diary for exceptions.
    [06/02/2013 INFO 17:39:19.692 IS JMXCallExecutorThread] Try to connect to a JMX Manager on the host: idcprdgflocator2.carecorenational.com and port: 1099
    [06/02/2013 INFO 17:39:19.793 IS JMXCallExecutorThread] Connected to the Gemfire distributed system
    [06/02/2013 INFO 17:39:21.666 IS JMXCallExecutorThread] Added members: ccnscupadsgf01 (10552) < v14 >: 4709
    [06/02/2013 INFO 17:39:21.679 IS JMXCallExecutorThread] Updated the refreshInterval to 60000
    [06/02/2013 INFO 17:39:23.594 IS JMXCallExecutorThread] GemFire (7.0) Cache is created. Support PDX is available.
    [06/02/2013 INFO 17:39:23.710 IS JMXCallExecutorThread] GemFire jar in the classpath version: 7.0
    [06/02/2013 INFO 17:39:23.710 IS JMXCallExecutorThread] Is the system of GemFire version: 7.0
    [06/02/2013 INFO 17:39:23.710 IS JMXCallExecutorThread] The LIMIT clause is supported by this version of the GemFire system: false
    [06/02/2013 INFO 17:39:23.711 IS JMXCallExecutorThread] The user is connected successfully to JMX Manager to idcprdgflocator2.carecorenational.com: 1099
    [06/02/2013 INFO 17:40:01.633 IS query run] Pool preparation for members:
    [06/02/2013 SERIOUS, 17:40:04.692 IS run query] Error occurred during execution of the query: com.gemstone.gemfire.mgmt.DataBrowser.controller.QueryConfigurationPrms@5608a6fc com.gemstone.gemfire.mgmt.DataBrowser.query.QueryExecutionException: com.gemstone.gemfire.cache.client.NoAvailableServersException
    at com.gemstone.gemfire.mgmt.DataBrowser.query.QueryUtil.executeQuery(QueryUtil.java:74)
    at com.gemstone.gemfire.mgmt.DataBrowser.connection.internal.GemFireClientConnectionImpl.executeQuery(GemFireClientConnectionImpl.java:122)
    to com.gemstone.gemfire.mgmt.DataBrowser.controller.internal.QueryExecutionHelper$ QueryExecutor.run (QueryExecutionHelper.java:169)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: com.gemstone.gemfire.cache.client.NoAvailableServersException
    at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.borrowConnection(ConnectionManagerImpl.java:246)
    at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:135)
    at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:114)
    at com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:638)
    at com.gemstone.gemfire.cache.client.internal.QueryOp.execute(QueryOp.java:51)
    at com.gemstone.gemfire.cache.client.internal.ServerProxy.query(ServerProxy.java:81)
    at com.gemstone.gemfire.cache.query.internal.DefaultQuery.executeOnServer(DefaultQuery.java:282)
    at com.gemstone.gemfire.cache.query.internal.DefaultQuery.execute(DefaultQuery.java:213)
    at com.gemstone.gemfire.cache.query.internal.DefaultQuery.execute(DefaultQuery.java:195)
    at com.gemstone.gemfire.mgmt.DataBrowser.query.QueryUtil.executeQuery(QueryUtil.java:70)
    ..
    . 3 more
    [06/02/2013 SERIOUS, 17:40:04.694 IS query result processor] Error executing query: com.gemstone.gemfire.mgmt.DataBrowser.query.QueryExecutionException: com.gemstone.gemfire.cache.client.NoAvailableServersException
    at com.gemstone.gemfire.mgmt.DataBrowser.query.QueryUtil.executeQuery(QueryUtil.java:74)
    at com.gemstone.gemfire.mgmt.DataBrowser.connection.internal.GemFireClientConnectionImpl.executeQuery(GemFireClientConnectionImpl.java:122)
    to com.gemstone.gemfire.mgmt.DataBrowser.controller.internal.QueryExecutionHelper$ QueryExecutor.run (QueryExecutionHelper.java:169)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: com.gemstone.gemfire.cache.client.NoAvailableServersException
    at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.borrowConnection(ConnectionManagerImpl.java:246)
    at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:135)
    at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:114)
    at com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:638)
    at com.gemstone.gemfire.cache.client.internal.QueryOp.execute(QueryOp.java:51)
    at com.gemstone.gemfire.cache.client.internal.ServerProxy.query(ServerProxy.java:81)
    at com.gemstone.gemfire.cache.query.internal.DefaultQuery.executeOnServer(DefaultQuery.java:282)
    at com.gemstone.gemfire.cache.query.internal.DefaultQuery.execute(DefaultQuery.java:213)
    at com.gemstone.gemfire.cache.query.internal.DefaultQuery.execute(DefaultQuery.java:195)
    at com.gemstone.gemfire.mgmt.DataBrowser.query.QueryUtil.executeQuery(QueryUtil.java:70)
    ... 3 more

    If you set the gemfire bind-address on the cache server, applications will be able to connect. If a bind-address is not defined in gemfire.properties for a server remote cache, applications unfortunately just silently by default is localhost. This is something that will have to solve. In the meantime, you can work around this by setting the property gemfire bind-address on the cache servers for either the IP address or host name.

  • Execution of the query against the service

    I wonder what's the difference between running a query on a region that partitioned for a set of objects cached vs using a function distributed to the combined results and return them to the node running?

    The problem, I'm trying make me get all objects from the cache in a region that partitioned a certain type and then perform a calculation on the subject after I he gains the cache to see if it should be added to all final results that I return to my request. I'm not aiming for a specific node for these objects; they can reside anywhere in the partitioned area. Is this the same difference using a query and running the calculation on each object in the result of the query defined in terms of running a distributed function and perform the calculation in distributed mode before returning the results to the running node?

    I think I would use the API to query within the service (Query.execute (RegionFunctionContext)) to query local entries. Are you familiar with the API Query.execute (RegionFunctionContext)? Basically, who runs the query only on local data.

    Then filter these additional results in the function, and then finally to return results filtered out to the customer. Do the same filtering on each local server before returning anything to the client. According to the difference between the result set size and size final filtered results, you will gain a lot of IO, not to mention the serialization/deserialization. You may also be able to do the calculation in the query itself if you have a method for this in the object.

    Barry

  • Structured XMLIndex not used by the query

    Hello

    We try to use XMLIndexes structured for a query. But they are not used. A sample of similar work is as follows:


    -Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Example of XML data on the XMLTYPE column is:

    <?xml version="1.0" encoding="UTF-8" standalone='yes'?>  
    <abc:tagOne preparationTime="2012-10-17T13:01:23.000Z" schemaVersion="1.3.9.0" xsi:schemaLocation="" xmlns:def="DEF" xmlns:abc="ABC"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
        <def:tagTwo>  
            <def:tagThree id="Identity1">  
                <def:Section domain="Domain123">10000</def:Section>  
            </def:tagThree>  
            <def:tagThree id="Identity2">  
                <def:Section domain="Domain123">20000</def:Section>  
            </def:tagThree>  
            <def:tagThree id="Identity3">  
                <def:Section domain="Domain123">30000</def:Section>  
            </def:tagThree>  
            <def:tagThree id="Identity4">  
                <def:Section domain="Domain123">40000</def:Section>  
            </def:tagThree>  
        </def:tagTwo>  
    </abc:tagOne>
    
    
    
    
    



    Query is like:

    select  XMLAGG(XML_MESSAGE)  
        from INT_PART_TABLE  
        where XMLExists('  
            declare namespace abc="ABC";  
            declare namespace def="DEF";  
            $Message/abc:tagOne/def:tagTwo/def:tagThree[@id="Identity4"][def:Section[@domain="Domain123"]  = ("50000", "40000") ]'  
            passing  
            xML_mESSAGE as "Message"  
        )
    
    
    
    
    


    We try to create indexes structured on the column of xmltype, as defined in the XML example file:

    CREATE INDEX INT_PART_TABLE_SXI
       ON INT_PART_TABLE (XML_MESSAGE)
       INDEXTYPE IS XDB.XMLINDEX
          PARAMETERS ('XMLTABLE INT_PART_content_table_01
                               XMLNAMESPACES (''ABC'' AS "abc",
                                              ''DEF'' AS "def"),  
                               ''/abc:tagOne/def:tagTwo''
                       COLUMNS
                         xmltagTwo      XMLTYPE  PATH ''/abc:tagOne/def:tagTwo''  VIRTUAL
                       XMLTABLE INT_PART_content_table_02
                         XMLNAMESPACES (''DEF'' AS "def"),
                         ''/def:tagTwo''
                                PASSING xmltagTwo
                                 COLUMNS 
                                 xmltagThree     XMLTYPE  PATH ''/def:tagThree''   VIRTUAL
                       XMLTABLE INT_PART_content_table_03
                          XMLNAMESPACES (''DEF'' AS "def"),    
                          ''/def:tagThree''
                             PASSING xmltagThree
                               COLUMNS 
                               section number PATH ''def:Section'',
                               domain varchar2(20) PATH ''@domain'',
                               id varchar2(20) PATH ''@id''
                  ')local;
    
    
    
    
    

    Table structure:

    CREATE TABLE INT_PART_TABLE
    (
       DB_ID            VARCHAR2 (10 BYTE),
       xML_mESSAGE      SYS.XMLTYPE,
       LOAD_TIMESTAMP   TIMESTAMP (6)
    )
    XMLTYPE xML_mESSAGE
       STORE AS BINARY XML
       (ENABLE STORAGE IN ROW
        CHUNK 16384
        RETENTION
        CACHE READS NOLOGGING)
       ALLOW NONSCHEMA
       DISALLOW ANYSCHEMA
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (BUFFER_POOL DEFAULT)
    PARTITION BY RANGE (LOAD_TIMESTAMP)
       (PARTITION P_12092012 VALUES LESS THAN (TIMESTAMP ' 2012-09-12 00:00:00')
           LOGGING
           NOCOMPRESS
           PCTFREE 10
           INITRANS 1
           MAXTRANS 255
           STORAGE (INITIAL 512 K
                    NEXT 512 K
                    MINEXTENTS 1
                    MAXEXTENTS UNLIMITED
                    PCTINCREASE 0
                    BUFFER_POOL DEFAULT),
        PARTITION MAX VALUES LESS THAN (MAXVALUE)
           LOGGING
           NOCOMPRESS
           PCTFREE 10
           INITRANS 2
           MAXTRANS 255
           STORAGE (INITIAL 128 K
                    NEXT 128 K
                    MINEXTENTS 1
                    MAXEXTENTS UNLIMITED
                    PCTINCREASE 0
                    BUFFER_POOL DEFAULT))
    PARALLEL (DEGREE 8 INSTANCES 1);
    
    
    
    
    

    - But the query above does not use the XMLINDEX STRUCTURE and instead turns to FTS INT_PART_TABLE.  Please help here.

    Is it the wrong way I created structured Index.

    (I tried a few other ways where I got-> ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected - singleton sequence got several sequence element).

    S ' Please NOTE that I used two "VIRTUAL" during the creation of the Index as otherwise I was getting the error:
    ORA-29958: fatal error occurred in the execution of routine ODCIINDEXCREATE
    ORA-30984: the XMLType column must be declared as virtual

    Please suggest. Thank you.

    Finally some time to watch this...

    The following works for me:

    Connected to:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    SQL > create table (int_part_table)

    2 db_id varchar2 (10 byte)

    3, xml_message xmltype

    4, load_timestamp timestamp (6)

    5)

    store xml_message 6 xmltype to the binary xml format

    7 partition by range (load_timestamp)

    () 8

    9 lower values p_12092012 partition to (to_timestamp ('2012-09-12 00:00:00 ',' YYYY-MM-DD HH24:MI:SS'))))

    10, partition p_max values less than (maxvalue)

    11)

    12 parallel (degree 8 instances 1);

    Table created.

    SQL > create index int_part_table_sxi on int_part_table (xml_message)

    2 indextype is xdb.xmlindex

    3 rooms

    4 parameters (q'~)

    5 XMLTABLE int_part_content_table_01

    6 XMLNAMESPACES ('ABC' AS 'abc', 'DEF' AS 'def'),

    7 ' / abc: Tallet / def:tagTwo / def:tagThree'

    8 COLUMNS

    9 article binary_double PATH 'def:Section '.

    10, area varchar2 (20) PATH 'def:Section/@domain '.

    11, id varchar2 (20) PATH '@id '.

    12 ~');

    The index is created.

    SQL >

    SQL >

    SQL > insert into int_part_table values)

    2 '1'

    3, xmltype (')

    4

    ' NS:ABC = 'ABC' xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" > ".

    5

    6

    7              10000

    8

    9

    10 20000

    11

    12

    13 30000

    14

    15

    16 40000

    17

    18

    19 ')

    20, systimestamp

    (21);

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > exec dbms_stats.gather_table_stats (user, 'INT_PART_TABLE');

    PL/SQL procedure successfully completed.

    SQL >

    SQL >

    SQL > set autotrace traceonly explain

    SQL > set lines 200

    SQL > define pages 100

    SQL >

    SQL > select / * + no_parallel * / xml_message

    2 of int_part_table

    3 where (XMLExists)

    4 ' declare namespace abc = "ABC"; (::)

    5 declare def namespace = "DEF"; (::)

    /ABC:tagOne/def:tagTwo/def:tagThree[@ID="Identity4 6 '.

    7 and def:Section/@domain="Domain123.

    8 and (def:Section = 40000

    9 or def:Section = 50000)]"

    10 passage xml_message

    11        ) ;

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 3112612945

    ---------------------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name                      | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |

    ---------------------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |                           |     1.   417.    15 (0) | 00:00:01 |       |       |

    |   1.  SEMI NESTED LOOPS.                           |     1.   417.    15 (0) | 00:00:01 |       |       |

    |   2.   RANGE OF PARTITION ALL THE |                           |     1.   367.    14 (0) | 00:00:01 |     1.     2.

    |   3.    TABLE ACCESS FULL | INT_PART_TABLE |     1.   367.    14 (0) | 00:00:01 |     1.     2.

    |   4.   ITERATOR SYSTEM PARTITION.                           |     1.    50.     1 (0) | 00:00:01 |   KEY |   KEY |

    |*  5 |    TABLE ACCESS BY LOCAL INDEX ROWID | INT_PART_CONTENT_TABLE_01 |     1.    50.     1 (0) | 00:00:01 |   KEY |   KEY |

    |*  6 |     INDEX RANGE SCAN | SYS78560_78563_RID_IDX |     1.       |     0 (0) | 00:00:01 |   KEY |   KEY |

    ---------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    5 - filter("SYS_SXI_0".") ID "="Identity4"AND ("SYS_SXI_0"". ")" SECTION "IS 4.0E + 004 D OR 'SYS_SXI_0'." SECTION "(= 5.0E + 004 D) AND"

    'SYS_SXI_0 '. ("DOMAIN"="Domain123")

    6 - access ("INT_PART_TABLE". ROWID = "SYS_SXI_0." ("' RID ')

    filter (TBL$ OR$ IDX$ PART$ NUM ("DEV".) "INT_PART_TABLE", 0,0,0, "INT_PART_TABLE". ROWID) TBL = $ OR$ IDX$ PART$ NUM ("DEV". "INT_PAR

    T_CONTENT_TABLE_01", 0,0,0,"SYS_SXI_0. " ROWID))

    A few things to know:

    -use BINARY_DOUBLE datatype to untyped (i.e. not based on a diagram) the numerical values of the XML index.

    -J' developed the sequence iterator predicate you were using for a Boolean expression GOLD. Otherwise, the index is not used as intended.

    You can also create a secondary index that satisfies the predicate #5 (see red part above):

    SQL > create index int_part_content_table_01_ix1

    2 on local int_part_content_table_01 (id, field, section);

    The index is created.

    SQL >

    SQL > select / * + no_parallel * / xml_message

    2 of int_part_table

    3 where (XMLExists)

    4 ' declare namespace abc = "ABC"; (::)

    5 declare def namespace = "DEF"; (::)

    /ABC:tagOne/def:tagTwo/def:tagThree[@ID="Identity4 6 '.

    7 and def:Section/@domain="Domain123.

    8 and (def:Section = 40000

    9 or def:Section = 50000)]"

    10 passage xml_message

    11        ) ;

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 3704965392

    --------------------------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name                          | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |

    --------------------------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |                               |     1.   417.     4 (25) | 00:00:01 |       |       |

    |   1.  NESTED LOOPS |                               |     1.   417.     4 (25) | 00:00:01 |       |       |

    |   2.   UNIQUE FATE |                               |     2.   100.     2 (0) | 00:00:01 |       |       |

    |   3.    SYSTEM PARTITION ALL |                               |     2.   100.     2 (0) | 00:00:01 |     1.     2.

    |   4.     TABLE ACCESS BY LOCAL INDEX ROWID | INT_PART_CONTENT_TABLE_01 |     2.   100.     2 (0) | 00:00:01 |     1.     2.

    |*  5 |      INDEX RANGE SCAN | INT_PART_CONTENT_TABLE_01_IX1 |     1.       |     1 (0) | 00:00:01 |     1.     2.

    |*  6 |   TABLE ACCESS BY ROWID USER | INT_PART_TABLE |     1.   367.     1 (0) | 00:00:01 | ROWID | ROWID |

    --------------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    5 - access("SYS_SXI_0".") ID '= 'Identity4' AND 'SYS_SXI_0'." DOMAIN "=" Domain123 ")

    filter ("SYS_SXI_0". "SECTION"IS 4.0E + 004 D OR 'SYS_SXI_0'." SECTION "(= 5.0E + 004 D)"

    6 filter (TBL$ OR$ IDX$ PART$ NUM ("DEV".) "INT_PART_TABLE", 0,0,0, "INT_PART_TABLE". ROWID) TBL = $ OR$ IDX$ PART$ NUM ("DEV". "INT_PART_CON

    TENT_TABLE_01", 0,0,0,"SYS_SXI_0. " ROWID))

  • The right way to store the results of the query

    Hey wizards Oracle,.

    I have a few questions that take a long time to run. Given that the results of these queries change only once a day, I will execute queries every morning and store their results in a table.

    I was going to serialize them in chains to the CSV format and then store them as CLOB. But shit, Oracle is a data table, storage system! This is reinventing the wheel within a wheel.
    Then I thought about creating one table per query would be the right way to store their results. But ordinary tables data recovery would be slow, because I would need to create an additional of ORDER_BY column to maintain the order of the results of the query.

    It seems that there is a way to store varrays in the LOB columns, but it does not seem to be appropriate.
    There may be a caching mechanism that could help?

    Does anyone know the proper way to store the result of a query?

    What you describe is a reinvention of the materialized views.
    Have you considered using them?

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • The query sql without prescription by will return same result on several tracks?

    Hello

    I have a sql without a prescription and I limit the number of rows to 100 max per rownum < 100. Now the question is, if the data set on which this sql is running, does not change, the sql returns the same result the performance of several?

    For example, there are 150 lines and the sql returns 100 rows because of rownum < 100. Now running the same sql several times, I have the same set of 100 lines? or it could be 150? On the basis of these the kind of database engine and return data when no order by clause are provided?

    Thank you for your time.

    -Hozy

    Hi, Hozy,

    Hozy says:
    Hello

    I have a sql without a prescription and I limit the number of rows to 100 max per rownum< 100.="" now="" the="" question="" is,="" if="" the="" data="" set="" on="" which="" this="" sql="" runs,="" does="" not="" change,="" will="" the="" sql="" return="" the="" same="" result="" set="" on="" multiple="">

    N ° if there is no ORDER BY clause, then there is no guarantee that the order will remain the same. If the table is small, the output will probably be the same thing, but you can't count on it.
    I guess that you do not have a CONNECT BY query. CONNECT BY queries without ORDER BY clause or brothers and SŒURS of ORDER BY, the output is partially ordered.

    For example, there are 150 lines and the sql returns 100 rows due to rownum< 100.="" now="" on="" executing="" the="" same="" sql="" multiple="" times,="" will="" i="" get="" the="" same="" set="" of="" 100="" rows?="" or="" it="" could="" be="" any="" of="" the="" 150?="" on="" what="" bases="" these="" the="" database="" engine="" sort="" and="" return="" data="" when="" no="" order="" by="" clause="" is="">

    No, you necessarily will not get the same 100 lines each time. ROWNUM reflects the order in which the establishment has recovered the lines.
    Say you run the query at 11:00. Maybe do you a full table scan to obtain the data on the drive, and the order of the lines is determined by how it data happens to be on the disk. As the data is read from the disk, it is cached in memory.
    Say you run the same exact query at 12:00, without changing the table. Instead of retrieve all data from the disk, Oracle will try to use the blocks that are cached in memory, which is not necessarily the way the blocks are stored on the disk. If some of the older blocks 11:00 to 12:00 (otherwise said, some, but not all, blocks are more in memory because memory was required for other purposes), then the items picked up at 11:00 can be recovered first at 12:00 and the lines that I have high ROWNUMs at 11:00 can get low ROWNUMs at 12:00. (See Matthew 7:30.)

    Again, you would never notice it on a small table. You can run this query

    SELECT  ename
    FROM    scott.emp
    WHERE   ROWNUM  < 10;
    

    a thousand times and get the same results every time. You will get the same results the 1001eme time? Probably, but not necessarily.

    If you want the output to be in a particular order, to use an ORDER BY clause in the main query.
    If you want ROWNUM to reflect a particular order, use a subquery with an ORDER BY clause and ROWNUM reference in the main query.

  • Slow index by using the query. Fast with full table Scan.

    Salvation;

    (Thanks for the links)

    Here's my question correctly formatted.

    The query:
    SELECT count(1)
    from ehgeoconstru  ec 
    where ec.TYPE='BAR'  
    AND ( ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') )   
    and deathdate is null 
    and substr(ec.strgfd, 1, length('[CIMText')) <> '[CIMText'
    Works on 32 seconds!


    Same query, but with an extra where clause:
    SELECT count(1)
    from ehgeoconstru  ec 
    where ec.TYPE='BAR'  
    and  ( (ec.contextVersion = 'REALWORLD')     --- ADDED HERE
    AND ( ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') ) )  
    and deathdate is null 
    and substr(ec.strgfd, 1, length('[CIMText')) <> '[CIMText'
    This is 400 seconds.

    It should return data from a table, given the conditions.

    The database version is Oracle9i Release 9.2.0.7.0

    These are the parameters relevant for the optimizer:
    SQL> show parameter optimizer
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    optimizer_dynamic_sampling           integer     1
    optimizer_features_enable            string      9.2.0
    optimizer_index_caching              integer     99
    optimizer_index_cost_adj             integer     10
    optimizer_max_permutations           integer     2000
    optimizer_mode                       string      CHOOSE
    
    SQL> 
    Here is the output of the PLAN to EXPLAIN for the first quick query:
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    | Id  | Operation                     |  Name               | Rows  | Bytes | Cost  |
    --------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT     |                         |           |       |       |
    |   1 |  SORT AGGREGATE       |                         |           |       |       |
    |*  2 |   TABLE ACCESS FULL   | EHCONS            |       |       |       |
    --------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    
       2 - filter(SUBSTR("EC"."strgfd",1,8)<>'[CIMText' AND "EC"."DEATHDATE"
                  IS NULL AND "EC"."BIRTHDATE"<=TO_DATE('2009-10-06 11:52:12', 'yyyy
    -mm-dd
    
                  hh24:mi:ss') AND "EC"."TYPE"='BAR')
    
    Note: rule based optimization
    Here is the output of the EXPLAIN of PLAN for slow queries:
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
       |       |
    
    |   1 |  SORT AGGREGATE              |                             |       |
       |       |
    
    |*  2 |   TABLE ACCESS BY INDEX ROWID| ehgeoconstru      |       |
       |       |
    
    |*  3 |    INDEX RANGE SCAN          | ehgeoconstru_VSN  |       |
       |       |
    
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    2 - filter(SUBSTR("EC"."strgfd",1,8)<>'[CIMText' AND "EC"."DEATHDATE" IS
     NULL AND "EC"."TYPE"='BAR')
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
       3 - access("EC"."CONTEXTVERSION"='REALWORLD' AND "EC"."BIRTHDATE"<=TO_DATE('2
    009-10-06
    
                  11:52:12', 'yyyy-mm-dd hh24:mi:ss'))
           filter("EC"."BIRTHDATE"<=TO_DATE('2009-10-06 11:52:12', 'yyyy-mm-dd hh24:
    mi:ss'))
    
    
    Note: rule based optimization
    The TKPROF output for this slow statement is:
    TKPROF: Release 9.2.0.7.0 - Production on Tue Nov 17 14:46:32 2009
    
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    
    Trace file: gen_ora_3120.trc
    Sort options: prsela  exeela  fchela  
    ********************************************************************************
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing 
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    ********************************************************************************
    
    SELECT count(1)
    from ehgeoconstru  ec
    where ec.TYPE='BAR'
    and  ( (ec.contextVersion = 'REALWORLD')
    AND ( ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') ) )
    and deathdate is null
    and substr(ec.strgfd, 1, length('[CIMText')) <> '[CIMText'
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        2      0.00     538.12     162221    1355323          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        4      0.00     538.12     162221    1355323          0           1
    
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 153  
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
          1  SORT AGGREGATE 
      27747   TABLE ACCESS BY INDEX ROWID OBJ#(73959) 
    2134955    INDEX RANGE SCAN OBJ#(73962) (object id 73962)
    
    ********************************************************************************
    
    alter session set sql_trace=true
    
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        0      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.02          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        1      0.00       0.02          0          0          0           0
    
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer goal: CHOOSE
    Parsing user id: 153  
    
    
    
    ********************************************************************************
    
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.02          0          0          0           0
    Fetch        2      0.00     538.12     162221    1355323          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        5      0.00     538.15     162221    1355323          0           1
    
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    
    
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        0      0.00       0.00          0          0          0           0
    
    Misses in library cache during parse: 0
    
        2  user  SQL statements in session.
        0  internal SQL statements in session.
        2  SQL statements in session.
    ********************************************************************************
    Trace file: gen_ora_3120.trc
    Trace file compatibility: 9.02.00
    Sort options: prsela  exeela  fchela  
           2  sessions in tracefile.
           2  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           2  SQL statements in trace file.
           2  unique SQL statements in trace file.
          94  lines in trace file.
    Published by: PauloSMO on November 17, 2009 04:21

    Published by: PauloSMO on November 17, 2009 07:07

    Published by: PauloSMO on November 17, 2009 07:38 - title changed to be more correct.

    Although your optimizer_mode is choosing, it seems that there are no statistics collected on ehgeoconstru. The absence of estimated costs and estimated row counts of each of the stages of the plan and the "Note: optimization based on rules" at the end of these two plans would tend to confirm this.

    Optimizer_mode choose means that if statistics are collected then it will use the CBO, but if no statistic is present in any of the tables in the query, the optimizer to rule will be used. The RBO tends to be happy in the best of the index case. I guess the index ehgeoconstru_VSN contextversion as the main column and also includes the date of birth.

    You can either gather statistics on the table (if all other tables have statistics) using dbms_stats.gather_table_stats, or suggest the query to use a full scan instead of index. Another solution would be to apply a function or an operation against the contextversion to prevent the use of the index. something like this:

    SELECT COUNT(*)
    FROM ehgeoconstru  ec
    WHERE ec.type='BAR' and
          ec.contextVersion||'' = 'REALWORLD'
          ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') and
          deathdate is null and
          SUBSTR(ec.strgfd, 1, LENGTH('[CIMText')) <> '[CIMText'
    

    or maybe UPPER (ec.contextVersion) so that would not change the rows returned.

    John

  • attempts to cancel the query discoverer - it takes long time to cancel...

    Hello world

    I cancelled a beak of query. It took a long time to run

    Now it takes a long time to cancel

    The admin is out to lunch...

    all advice, pls, thx, sandra

    Hi, Sandra
    In general, the reason for the cancellation of a query is that it has worked too long - right?

    Behind the scenes, one of two things happening, either:

    1. the request was to have a hard time finding data and is always looking, or
    2. the query found some data but not enough to satisfy the query governor parameters

    For these, depending on the amount of data has so far been recovered, discoverer must these data somewhere. This is called a cache. The data you put in a cache more must be allowed to come out it should you decide not to go forward. This is probably what has happened to you.

    Also, when you cancel a query you are generally posed a question about whether discoverer must keep the last change but does not return any data. If you click Yes in response to this question is usually what triggers the compensation of the cache. Most of the time I just click No, even if I made a little change. I tend to get my quick return query.

    Finally, if your discoverer worksheet is a crosstab or use Page elements, or even both at the same time, it is one of the causes of a long-running query. In these scenarios, discoverer has buckets to calculate and he has no idea how many buckets to until he has read all the data.

    My Discoverer 10 g manual and in my training I speak on the motion of The Twilight Zone. These are queries than ever or never looks back all the data and either expire or must be stopped manually. Sometimes these runaway queries trying to return each row of data in the database, but more generally, they are caused by the use of overcasual of page elements or tables double entry.

    Let us hope that this logbook help
    Best wishes
    Michael

  • Rewrite the query without a clause EXISTS

    I would like to know another way to write the query without the EXISTS clause below. The main problem is with the inner query not allowing Java Hibernate to cache the results of the query.

    Select max (wt.wtime) wttme
    x wt.
    PIA,
    z g
    where wt.vid = v.vid and
    v.GID = g.gid and
    g.gname = "XXX" and
    not exists (select *)
    x wt1.
    y v1,.
    z g1
    where wt1.vid = v1.vid and
    v1. GID = g1.gid and
    G1.gname = "XXX" and
    (wt1.last_updated < (sysdate-. 0013) or)
    Upper (WT1. Error) '= t'
    )
    )

    z / / DESC;
    Name of Type Null
    GID NOT NULL NUMBER
    GNAME NOT NULL VARCHAR2 (100)
    ACTIVE NON-NULL CHAR (1)
    DATE OF UPDATE_DATE
    UPDATED_BY VARCHAR2 (50)

    GID GNAME UPDATE_DATE ACTIVE UPDATED_BY
    1 XXX Y 6 July 09 14:50:24 Test

    y / / DESC;
    Name of Type Null
    VID NOT NULL NUMBER
    VNAME NOT NULL VARCHAR2 (100)
    GID NOT NULL NUMBER
    ACTIVE NON-NULL CHAR (1)
    DATE OF UPDATE_DATE
    UPDATED_BY VARCHAR2 (50)

    VID VNAME GID UPDATE_DATE ACTIVE UPDATED_BY
    1 ICT 1 Y 6 July 09 14:50:24 Test
    arvato 2 1 O 6 July 09 14:50:24 Test

    / / DESC x;
    Name of Type Null
    VID NOT NULL NUMBER
    NUMBER OF WTIME
    ERROR VARCHAR2 (4000)
    NOT CLOSED NULL CHAR (1)
    LAST_UPDATED DATE

    VID WTIME LAST_UPDATED CLOSED ERROR
    1 65 N N 10 JUNE 09 00:00:00
    2 23 N N AUGUST 10 09 00:00:00

    Ken R says:
    What I would like to have is a query WITHOUT a clause EXISTS and to implement INSIDE logical query * (wt1.last_updated< (sysdate="" -="" .0013)="" or="" upper(wt1.error)='T' )*="" in="" the="" outer="">

    Well have a look at the two queries above then.

Maybe you are looking for

  • Impossible to use Vodafone 4 G

    Yesterday, I received Vodafone 4 G sim and activated the plan of 4G. SΘlectionnΘe 4 G mobile networks. Restart the phone. However, I am able to connect to 3G only. I tried to put the 4G sim card in both slots. But still none of them worked. This prob

  • I currently have 91 processes running and 20 of them are svchost.exe

    I have a toshiba satellite A135-S4467 with an Intel (r) Core (TM) 2 CPU TS5200 @ 1.60 GHz.  I am running Windows Vista Home Premium.  An operating system for 32-bit with 2 GB of RAM.  My computer is not working as it should... for example I get "not

  • My Vista once supported resolution of 1280 x 1024 32-bit true color, now it does not help?

    I'm running my Vista OS, set the screen resolution 1280 x 1024 32 bit True color forever. Was playing a game when the game crashed. After the computer restarts, I have noticed that I'm stuck on 1280 x 720. Display options on the ATI Radeon HD 4350 sh

  • I wan to use connections cable and wireless with Windows 7.

    I use Windows 7. I have a wired ethernet connection, but also internal wireless. I want to be able to use both connections. I'm using VMware Workstation and it allows me to specify which adapter to use with the virtual machines. However, when Windows

  • Adobe Muse in the Assembly browser

    I use the editing in the browser and it works for the desktop version, but I can't change the text on the version of the phone. The site is brothers4x4.com please help!