Cache spatial data or query

I have an application where, as expected, the first spatial query is taking longer for users then when they submit the same or similar query layer on in the session. Is there a way to cache that first query before our users even start the application so that they won't have to wait for the first hard parse? Or would trying to keep the table itself in the cache be a way to go?
Thanks
-mcslain

Ok, there's two types of 'cache' in play here. The first is the shared SQL. The first time a query is run it will be hard parsed. The explain plan will be stored in the shared pool thereafter until it is aged out (shouldn't happen often normally). Any subsequent queries using the same SQL (assuming you're using bind variables) will reuse the shared SQL. You could force that SQL into the shared pool to avoid users having to experience a hard parse (setup a procedure and dbms_schedule it), but you shouldn't need to do so. If you're getting a lot of hard parses, then either you're not using bind variables, or something is aging the SQL out of the shared pool - that could be too many DB shutdown/startups, shared pool too small, etc.
I'd address that problem first.
The other 'cache' is the buffer cache. If the data to be read by the query doesn't yet exist in the buffer cache, then it'll have to go to disk to get it. That'll take longer than reading from the buffer cache. So the first query will probably take longer than subsequent ones. You could look at pinning a table in the KEEP pool, but I'd only do that for small tables which are accessed very often.

Similar Messages

  • Spatial data schema query

    I need to interact with spatial data, but I'm getting errors when tables have a SDO field in them. Is this supposed to work now?
    I'm using an OracleDataAdapter, and calling adapter.FillSchema to retrieve the table's schema. I get an exception saying that a Custom type mapping for the SDO field is not specified or invalid. Do I need to manually map something to get SDO fields to work?
    Thanks

    Yes you have.
    See here for an example:
    http://www.orafaq.com/forum/t/27794/0/

  • Retrieving spatial and non spatial data in one query

    Hello. I am having slight difficulties using JDBC to retrieve both spatial and non spatial data in the same query. The following is code from a sample program of mine that retrives spatial data from spatial tables.
    (In spatialquery geom is a geometry column and city is simply the name of the city):
    try
    Geometry geom = null;
    String database = "jdbc:oracle:thin:@" + m_host + ":" + m_port + ":" + m_sid;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = (OracleConnection)DriverManager.getConnection(database, sUsername, sPassword);
    GeometryAdapter sdoAdapter =
    OraSpatialManager.getGeometryAdapter("SDO", "8.1.7", STRUCT.class, null, null, con);
    String spatialquery = "SELECT a1.geom, a1.city \n" +
    "FROM cities a1";
    Statement stmt = con.createStatement();
    OracleResultSet rs = (OracleResultSet) stmt.executeQuery(spatialquery);
    int i = 0;
    int noOfFeatures = 2;
    while (rs.next())
    for(i = 1; i <= noOfFeatures; i++)
    STRUCT dbObject = (STRUCT)rs.getObject(i);
    try
    geom = sdoAdapter.importGeometry(dbObject);
    catch(GeometryInputTypeNotSupportedException e)
    System.out.println("Input Type not supported");
    catch(InvalidGeometryException e)
    System.out.println("Invalid geometry");
    System.out.println(geom);
    }//end while loop
    This retrieves the sptial data fine, however when I attempt to retreive the non-spatial data I keep getting a "ClassCastException" error. I understand it is something to do with "STRUCT dbObject = (STRUCT)rs.getObject(i);" line. Can anyone tell me how to retrieve both spatial and non-spatial data in the one query using JDBC. I have tried nearly everything at this stage. Cheers joe

    Theresa A Radke
    Posts: 20
    OTN Member Since: Jul, 2001
    retrieving spatial and non spatial in same query. May 23, 2003 12:02 AM
    retrieving spatial and non spatial in same query.

  • Mapviewer - Spatial Data Cache

    I am trying to clear the spatial data cache in two different versions (mv10 & mv11ea) of Mapviewer without success. To confirm that the cache is being cleared I have enabled the report_stats as below in the mapViewerConfig.xml for both versions
        <spatial_data_cache   max_cache_size="64"
                              report_stats="true"
        />After a few requests I note the following in the log:
    Cache group PARCEL_VIEW_SHAPE_82473_PDT_GEOM statistics:
       capacity: 262144
           size: 145988
    load factor: 0.95
        # of chains: 88837
    max chain depth: 8
    avg chain depth: 1.6433242905546113
    empty bucket %: 0.6611137390136719
    total mem size : 28169KBKnowing (assuming) that this cache group is populated by a single theme that references the PARCEL_VIEW table I then issue the following via the Admin section of the Mapviewer control.
    <?xml version="1.0" standalone="yes"?>
    <non_map_request>
      <clear_theme_cache data_source="vicmap" theme="THEME_PARCEL" />
    </non_map_request>Then, after waiting patiently for the next set of statistics to appear in the log (BTW, is there a way to change the frequency from 10 minutes to something more regular?) I notice that the information for the cache group has not changed.
    Am I following the correct steps here? If I wish to clear the spatial cache, should I be monitoring these statistics?
    All advice most welcome.
    Ross.

    Hi Ross,
    we'll review the statistics reported and check why it is not changing. The frequency is currently hard-coded (5 minutes), and there is no parameter on the configuration file to change that. We may consider this in the future.
    Joao

  • Keep Oracle Spatial data in Coherence Caches?

    Can I keep Oracle Spatial data in Coherence Caches?

    You can store the Oracle Spatial data in Coherence caches. But creating Spatial indexes in Coherence neeeds too much effort, I guess. How do you create the Spatial geocoding package, map symbols, map styling rules and Spatial network model?
    Edited by: junez on 07-Jan-2010 12:24

  • Query for spatial data with a GeometryCollection fails

    There are exact 538 CurvePolygons (only exterior rings at this
    sample). All of them are valid geometries and equal in dimension
    and so on. Now I connect them to a GeometryCollection and query
    for other relating spatial data in some tables. It seems that
    the use of around (not exact!) 200 CurvePolygon in one
    GeometryCollection works fine but the adding of more
    CurvePolygon result in an error with the Spatial Index (I could
    add the ORA- error numbers if I have some data in my test tables
    again next days).
    Is there anybody else having trouble with these mysterious
    problem? Maybe there is a border by the number of points in
    GeometryCollection?
    (More details, programming code could be delivered)
    (working with Java 1.3.1, oracle.sdoapi.*, Oracle 8.1.7.)

    Hi Lutz,
    Could you provide more info or samples of what is going wrong?
    Also, could you try making sure the geometry you are passing in
    as the query window is valid (i.e. instead of passing it in as a
    query window, pass it into sdo_geom.validate_geometry).
    Thanks,
    Dan

  • Spatial data cache only 2048MB ??

    Why spatial data cache can be only less then 2048MB ??
    If I set up any value larger then this, it shows a negative numer of cache size in get_stats xml request (the same in logs when Mapviewer is starting).

    This is likely a bug. It assumes a 2gb limit.

  • Spatial Data Cache Setting

    Hi all,
    If I disable the cache, I mean if I set max_cache_size to 0 on mapviewerConfig, Will it affect mapviewer performance or speed?
    I have developed sample application to move a point data on web using mapviewer. After updating SDO_GEOMETRY column on database, I will refresh the map. The map will show moved point data only if I set max_cache_size to 0 on mapviewerConfig. Is there any mapviewer API is available to clear spatial data cache?
    Thanks,
    Sujnan

    This is likely a bug. It assumes a 2gb limit.

  • Spatial data warehouse

    hello,
    i'm doing a research in spatial data warehouse, does anyone who had doing the same thing? and are there any article that explain about it? (especially the ETL process).
    Does OWB support spatial data type?
    thanks
    hadi

    Hi Hakan,
    it's not easy to give a quick answer here.
    a) you want to compare warehouse tables with spatial tables
    To answer this very well you should define what is a warehouse table and what is a spatial table. In this forum you will get for spatial tables the definition "A spatial table is a table with one or more columns of type SDO_GEOMETRY". How do you define a spatial table and how do you define a warehouse table?
    b) you ask for performance
    Performance is not depending only on table type. Performance is depending on a lot of steps. For example on the work which has to be done to answer the question, can data read from buffer cache or must they be read from physical devices, execution plan .....
    I don't know if there is a official statement from Oracle which is usefull to answer your query.
    Can you ask a little bit particular please?
    In my experience there it is not adviseable to store tables in different databases (instances) when I have to query it together. If you split the tables in different instances, the execution has much more overhead because you have to talk to 2 instances and it will very hard for the optimizer to find the best execution plan.
    Regards
    U. Martin

  • Dynamic action - Cache server data

    APEX 4.2.2
    Is there a way to cache server side data in a global (page/document level) Javascript vector (bunch of key-value pairs) (associative array, array of objects or some such)? This way the data can be used by subsequent dynamic actions' Javascript code without querying the server over and over.
    I see that apex_util.json_from_sql is still undocumented after all these years. Are there any examples of using that API to do this sort of thing? Can someone please share?
    Thanks

    https://apex.oracle.com/pls/apex/f?p=57688:24
    I took a shot at this and it seems to work well using Javascript global objects for data storage. Hope this helps someone.
    1. Page attributes - Javascript global variables var gData,gLookup={};2. On-demand application process Get_Emps as apex_util.json_from_sql('select empno,ename from emp');3. Page Load dynamic action to invoke the application process and cache the data var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=Get_Emps',$v('pFlowStepId'));
    var retval=get.get();get=null;
    gData=apex.jQuery.parseJSON(retval);
    $.each(gData.row,function(i,obj){
       gLookup[obj.EMPNO]=obj.ENAME;
    });4. EMPNO page item - Standard OnChange dynamic action to SetValue of ENAME page item using the cached data - Javascript expression gLookup[$v(this.triggeringElement)]
    We document something when it is ready to be supported. This specific procedure isn't something we haven't invested in, and thus, per our discretion, have elected not to document or support it at this time.Fair enough.

  • Client automatically cache the data got from cache server?

    Hi expert,
    I have 2 questions about the client local cache. Would you please help to give me some suggestion?
    1. Will client automatically locally cache the data got from cache server the first time and automatically update the data in local cache when getting the same data from cache server again? I go through the API reference but cannot find any API to query the data currently cached in the local cache.
    2. If client will automatically cache the data got from cache server. Is there any way for a client to get the data event that happens to its local cache, such as entry created in local cache, entry deleted from local cache and entry updated in local cache? In my opinion, when getting an entry from cache server the first time, the MapListener's entry create event should be triggered. When getting the same entry again, the entry update event should be triggered.
    However, I have tried a client with replicated cache, a client with partitioned cache, an extend client with remote cache and a client with local cache(front cache part of near cache), the client (the NamedCache object has been set the MapListener) cannot get any event notification after getting data from cache server. By the way, my listener is OK since when putting data the entry create event and entry update event will be triggered.
    Your suggestion is very appreciated. :)

    Hi
    If I were you I would read this http://download.oracle.com/docs/cd/E14526_01/coh.350/e14510/toc.htm
    and particularly the section about Near Caching here http://download.oracle.com/docs/cd/E14526_01/coh.350/e14510/nearcache.htm#CDEFEAJG
    which is what you are asking about in your question.
    Near Caching is how Coherence stores data in the locally - which is the answetr to your first question. How Near Caching works is explained in the documentation.
    Events, which you ask about in your second question are explained here http://download.oracle.com/docs/cd/E14526_01/coh.350/e14510/delivereventsjava.htm#CBBIIEFA
    It might be that ContinuousQueryCache is closer to what you want. This is explained here http://download.oracle.com/docs/cd/E14526_01/coh.350/e14510/queryabledatafabric.htm#sthref38 A ContinuousQueryCache is like having a sub-set of the underlying cache on the local client which you can then listen to etc...
    JK

  • Oracle date parameter query not working?

    http://stackoverflow.com/questions/14539489/oracle-date-parameter-query-not-working
    Trying to run the below query, but always fails even though the parameter values matches. I'm thinking there is a precision issue for :xRowVersion_prev parameter. I want too keep as much precision as possible.
    Delete
    from CONCURRENCYTESTITEMS
    where ITEMID = :xItemId
    and ROWVERSION = :xRowVersion_prev
    The Oracle Rowversion is a TimestampLTZ and so is the oracle parameter type.
    The same code & query works in Sql Server, but not Oracle.
    Public Function CreateConnection() As IDbConnection
    Dim sl As New SettingsLoader
    Dim cs As String = sl.ObtainConnectionString
    Dim cn As OracleConnection = New OracleConnection(cs)
    cn.Open()
    Return cn
    End Function
    Public Function CreateCommand(connection As IDbConnection) As IDbCommand
    Dim cmd As OracleCommand = DirectCast(connection.CreateCommand, OracleCommand)
    cmd.BindByName = True
    Return cmd
    End Function
    <TestMethod()>
    <TestCategory("Oracle")> _
    Public Sub Test_POC_Delete()
    Dim connection As IDbConnection = CreateConnection()
    Dim rowver As DateTime = DateTime.Now
    Dim id As Decimal
    Using cmd As IDbCommand = CreateCommand(connection)
    cmd.CommandText = "insert into CONCURRENCYTESTITEMS values(SEQ_CONCURRENCYTESTITEMS.nextval,'bla bla bla',:xRowVersion) returning ITEMID into :myOutputParameter"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.ReturnValue
    p.DbType = DbType.Decimal
    p.ParameterName = "myOutputParameter"
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion"
    v.Value = rowver
    cmd.Parameters.Add(v)
    cmd.ExecuteNonQuery()
    id = CType(p.Value, Decimal)
    End Using
    Using cmd As IDbCommand = m_DBTypesFactory.CreateCommand(connection)
    cmd.CommandText = " Delete from CONCURRENCYTESTITEMS where ITEMID = :xItemId and ROWVERSION = :xRowVersion_prev"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.Input
    p.DbType = DbType.Decimal
    p.ParameterName = "xItemId"
    p.Value = id
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion_prev"
    v.Value = rowver
    v.Precision = 6 '????
    cmd.Parameters.Add(v)
    Dim cnt As Integer = cmd.ExecuteNonQuery()
    If cnt = 0 Then Assert.Fail() 'should delete
    End Using
    connection.Close()
    End Sub
    Schema:
    -- ****** Object: Table SYSTEM.CONCURRENCYTESTITEMS Script Date: 1/26/2013 11:56:50 AM ******
    CREATE TABLE "CONCURRENCYTESTITEMS" (
    "ITEMID" NUMBER(19,0) NOT NULL,
    "NOTES" NCHAR(200) NOT NULL,
    "ROWVERSION" TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL)
    STORAGE (
    NEXT 1048576 )
    Sequence:
    -- ****** Object: Sequence SYSTEM.SEQ_CONCURRENCYTESTITEMS Script Date: 1/26/2013 12:12:48 PM ******
    CREATE SEQUENCE "SEQ_CONCURRENCYTESTITEMS"
    START WITH 1
    CACHE 20
    MAXVALUE 9999999999999999999999999999

    still not comming...
    i have one table each entry is having only one fromdata and one todate only
    i am running below in sql it is showing two rows. ok.
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  '830' and  '850'  and t1.U_frmdate ='20160801'  and  t1.u_todate='20160830'
    in commond promt
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  {?FromEmid} and  {?ToEmid} and t1.U_frmdate ={?FDate} and  t1.u_todate={?TDate}
    still not showing any results..

  • DB buffer cache vs. SQL query & PL/SQL function result cache

    Hi all,
    Started preparing for OCA cert. just myself using McGraw Hill's exam guide. Have a question about memory structures.
    Actually, DB buffer cache is used to copy e.g. SELECT queries result data blocks, that can be reused by another session (server process).
    There is also additional otion - SQL query & PL/SQL function result cache (from 11g), where also stored the results of such queries.
    Do they do the same thing or nevertheless there is some difference, different purpose?
    thanks in advance...

    There is also additional otion - SQL query & PL/SQL function result cache (from 11g), where also stored the results of such queries.Result cache located in shared pool.So it is one component of shared pool.When server process execute query(and if you configured result cache) then result will store in shared pool.Then next execution time run time mechanism will detect and consider using result cache without executing this query(if data was not changed this is happen detection time)
    Do they do the same thing or nevertheless there is some difference, different purpose?.Buffer cache and result cache are different things and purpose also,but result cache introduced to improve response time of query in 11g(but such mechanism also implemented in 10g subquery execution,in complex query).In buffer cache holds data blocks but not such results.
    Edited by: Chinar on Nov 4, 2011 4:40 AM
    (Removing lots of "But" word from sentences :-) )

  • Wrong cache for input-ready query

    Dear Expert,
    I encountered some issues about input-ready query. When I first open one input-ready query and input some plan data, I can save the data successfully. But after I saved data for the first query, if I don't re-connect the analyzer and open a new query, usually the plan data in the new query can not be saved successfully. After re-connect the analyzer, it works well. When I debug it, if I do not re-connect analyzer, I found the new query I opened still got some data which belong to the first query (Such as variable value). I guess it probably caused by some Bex cache? (It's not OLAP cache in RSCACHE, as we have disabled the cache for planning query in RSRT).
    Could you please help me with this? Is there any way we can disable this kind of cache for the input-ready query? Or if we have any solution to clear this kind of cache without re-connect bex analyzer every time when I open a new input-ready query.
    Thank you in advance.
    Best Regards,
    Fuyang

    Hi Fuyang,
    We are facing similar problem.
    1st problem:
    (1) When we run workbook that time variable values are automatically filled up.
    (2) Variable values for version, year is filled up and then query output is displaying.
    (3) There is no personalization or variant used. Its looks to me Values are coming from Cache.
    (4) Cleared RSRCACHE and there is no cache used for this query.
    (5) If we enter version = u201CZ2010u201D and Year = u201C2010u201D and after running workbook (input query) and then closing and reopening same variable values are coming. If we change version from u201CZ2010u201D to u201CZ2011u201D and run/save query and again reopening version variable values are coming again to u201CZ2010u201D.
    2nd problem:
    (1) We have planning sequence which is using below variables.
    (2) Version, Year, Plant.
    (3) Version and Year is input ready variables
    (4) Plant is Userexit variable.
    (5) Plant Dropdown is used.
    (6)When we execute planning sequence first time without filtering plant then it is working fine. Receiving message u201C100 records read,100 records changedu201D u2013 This is working fine.
    (7) When we use plant dropdown and filtering u201CABCu201D plant then planning sequence working fine and receiving message u201C20 records read, 20 records changedu201D u2013 This is working fine.
    (8)When we clear drop down/filter using CMD - REMOVE FILTER which is used in button clear plant u201CABCu201D filter. u2013 This is working fine.
    (9) Then we again apply planning sequence for all the records and receiving message u201C20 records read, 20 records changedu201D.  This is not working. The message should come u201C100 records read,100 records changedu201D
    This time plant variable has still with value u201CABCu201D and not clearing in variable cache.
    We are on below BI 7 level and above application is Excel based.
    SAP_ABA u2013 701-SAPKA70104
    SAP_BASIS-701-SAPKB70104
    SAP_BW-701-SAPKW70104
    BI_CONT-701-SAPK-70403INBICONT
    SAP GUI  7.1 patch 17
    SAP BI BEx AddOn 7.1 patch 10 (1000)
    Any help will be greatly appreciated.
    Thanks in advance.

  • Keep the Oracle Spatial data in memory

    I can keep any database tables in memory (for fast access) using Oracle Coherence (the In Memory Data Grid).
    Now I want to store Oracle Spatial data in memory, is it possible?

    I think it is possible. The difference is it is not easy to recreate some Spatial-related functions and procedures in caches. But you can invoke them from the in-memory applications using Oracle Spatial Java API.

Maybe you are looking for

  • Process Chain and CPS

    Hello all, We are currently having a problem with submitting process chains. When the chain runs it does not display any of steps in the process chain and where they are running from the job we submit (RSI_START_BW_CHAIN) So what we see is that the P

  • Replace an image by another with a javascript in Indesign CS6

    I am really desperate.  I have no idea where to start since I have no knowledge of javascript.  Can anyone please help? I need a javascript that replaces 5 logo's in an active, multi-page, CS6 document. In certain cases the logo's need to be replaced

  • Network Desktop needs to be refreshed after waking from sleep mode

    My network is running Win 7 32bit SP1, All users have their documents and desktop saved on the network. I'm testing two computers for a new sleep mode policy, and I've noticed that after waking up from sleep outlook will be disconnected and/or requir

  • Can you create a button that will go to multiple key frames?

    Hi, I am trying to make a rpg style character select interface.  What i am trying to do is very similar to the picture below. How do you create a button like the stats, gear, and supplies that will each show a different image or text depending on whi

  • JSTL, JSP Batch Update

    I need to do something like a batch update in one of my JSP pages, but not sure on how to do this. For example, instead of opening and updating just one row in my db table, I need to update multiple rows at the same time, how can i do this in JSP/SQL