Procedure cache question

Does SQL cache the entire TSQL batch or each individual TFS statement in a batch?  For cache match purposes, does it match on the entire batch or each statement within the batch will attempt to match a previously cached plan?
When I batch together two TSQL queries in mgmt studio and query the dmvs (dm_exec views/functions), I get two separate rows back where each row has a a different plan_handle, sql_handle, query_hash,query_plan_hash, and text.  The text for each row represents
a single query statement than the entire batch as the MSDN docs suggest.
select * from mytable1 where id = 1
select * from mytable2 where id = 2
go
SELECT 
cp.objtype
,qs.plan_handle
,qs.SQL_HANDLE
,QS.query_hash
,QS.query_plan_hash
,ST.[TEXT]
,cp.usecounts
,QS.EXECUTION_COUNT
,qs.total_physical_reads
,qs.total_logical_reads
,P.query_plan
FROM [SYS].[DM_EXEC_QUERY_STATS] AS [QS] 
INNER JOIN SYS.dm_exec_cached_plans cp on cp.plan_handle = qs.plan_handle
CROSS APPLY [SYS].[DM_EXEC_SQL_TEXT]([QS].[SQL_HANDLE]) AS [ST] 
CROSS APPLY [sys].[dm_exec_query_plan]([qs].[plan_handle]) as [p]
WHERE [st].[text] like '%mytable1%' or [st].[text] like '%mytable2%'
ORDER BY 1, [qs].[execution_count] desc;
go
The MSDN docs suggest that sql handle from dm_exec_query_stats represent a given TSQL batch of statements.   For caching purposes what constitutes a batch?
SQL2008

SQL Server caches the plan for the entire batch, the match when looking for a cache entry is based on a hash that is computed over the entire batch. Note that the hash is computed over the batch text as-is. That is, everything counts: spaces, comments, and
lowercase and uppercase counts differently.
But that is not all. If two users submits the same query batch, and the batch includes one or more table references where the schema is not specified, and the users have different default schema, that will result in two cache entries.
Furthermore, there are a number of SET options that must match for a cache hit. For instance, different settings for ARITHABORT will result in two cache entries.
As I said, SQL Server initially compiles a plan for the entire batch. However, during execution, recompiles may occur for a number of reasons, and recompilation is on statement level. This causes the part of the plan to be replaced, and as I recall the plan_handle
remains the same.
What happens in your case, is something called autoparameterisation. You may note that the query text in the cache has changed, and reads:
(@1 tinyint)SELECT * FROM [dbo].[mytable2] WHERE [id]=@1
That is not what you submitted. If you take a query batch where autoparameterisation does not occur, you will still see two entries in the output, because there is always one row per statement, but the sql_handle and plan_handle will be the same. For instance
try this:
create table mytable1 (id int NOT NULL)
create table mytable2 (id int NOT NULL)
go
DBCC FREEPROCCACHE
go
select * from dbo.mytable1 where id in (SELECT id FROM dbo.mytable2)
select * from dbo.mytable2 where id in (SELECT id FROM dbo.mytable1)
go
SELECT
cp.objtype
,qs.plan_handle
,qs.sql_handle
,qs.statement_start_offset
,qs.statement_end_offset
,qs.query_hash
,qs.query_plan_hash
,st.[text]
,cp.usecounts
,qs.execution_count
,qs.total_physical_reads
,qs.total_logical_reads
,p.query_plan
FROM [sys].[dm_exec_query_stats] AS [qs]
INNER JOIN sys.dm_exec_cached_plans cp on cp.plan_handle = qs.plan_handle
CROSS APPLY [sys].[dm_exec_sql_text](qs.[sql_handle]) AS st
CROSS APPLY [sys].[dm_exec_query_plan]([qs].[plan_handle]) as [p]
WHERE [st].[text] like '%mytable1%' or [st].[text] like '%mytable2%'
ORDER BY 1, [qs].[execution_count] desc;
go
DROP TABLE mytable1, mytable2
I have added the column statement_start_offset and statement_end_offset, so that you can see the entries are per statement.
By the way, all the DMVs are spelled in lowercase only, and I recommend that you stick to this. One day, you may need to run your queries on a case-sensitive system, and things like SYS.DM_EXEC_QUERY_STATS will not work for you in this case.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Data Cache & Procedure Cache

    All,
    How to view the size of Data cache & procedure cache?
    how to estimate the cahe size taken for a given query? Say for exampe, If i run a query , I just wanted to know how much of cache memort it took.

    karthi_mrkg wrote:
    All,
    How to view the size of Data cache & procedure cache?
    how to estimate the cahe size taken for a given query? Say for exampe, If i run a query , I just wanted to know how much of cache memort it took.Judging from this, and your other question on locking, you seem to have a background in some other SQL DBMS, other than Oracle...
    It might be a good idea that you spend a day or two, studying the Oracle Concepts guide.

  • Best size of procedure cache size?

    here is my dbcc memusage output:
    DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.
    Memory Usage:
                                       Meg.           2K Blks                Bytes
          Configured Memory:     14648.4375           7500000          15360000000
    Non Dynamic Structures:         5.5655              2850              5835893
         Dynamic Structures:        70.4297             36060             73850880
               Cache Memory:     13352.4844           6836472          14001094656
          Proc Cache Memory:        85.1484             43596             89284608
              Unused Memory:      1133.9844            580600           1189068800
    So if proc cache is too small? I can put used memory 1133M to proc cache. but as many suggested that proc cache should be 20% of total memory.
    Not sure it should be 20% of max memory or Total named cache memory?

    Hi
    Database size: 268288.0 MB
    Procedure Cache size is ..
    1> sp_configure 'procedure cache size'
    2> go
    Parameter Name                 Default     Memory Used  Config Value    Run Value         Unit                            Type
    procedure cache size           7000          3362132        1494221           1494221         Memory pages(2k)     dynamic
    1> sp_monitorconfig 'procedure cache size'
    2> go
    Usage information at date and time: May 15 2014 11:48AM.
    Name                      Num_free    Num_active  Pct_act Max_Used    Reuse_cnt   Instance_Name
    procedure cache size          1101704      392517  26.27       787437      746136 NULL
    1> sp_configure 'total logical memory'
    2> go
    Parameter Name           Default     Memory Used   Config Value      Run Value           Unit                         Type
    total logical memory        73728    15624170           7812085             7838533      memory pages(2k)     read-only
    I got to know that the oparameter 'Reuse_cnt' should be zero from an ASE expert.
    Suggest me if I need to increase the procedure cache with explanation
    Thanks
    Rajesh

  • Weblogic 8.1 SP2 + Sybase: Problem with Insufficient Procedure Cache Memory

    Hi all,
    Our Weblogic server(8.1, SP2) encountered a problem this week.
    It connects to Sybase.
    For a particular database query (which involves temporary tables), the DB seems to have run out of "Procedure Cache memory". And as a result, has thrown an exception.
    What is a bit wierd is that, the Weblogic, slowly, seems to have exhausted all its DB resources, and all the subsequent database queries (even the simple ones) have failed due to some error or the other.
    The weblogic required a re-start for it to acquire back its DB resources.
    Has somebody faced a similar problem before, please?
    On reading the Release Notes for WLS: 8.1, I see that the Service Packs SP4, SP5 seem to have a few bug fixes related to memory leaks (especially, in case a Prepared statement failed).
    [Related CRs are CR233948, CR179600, CR183190].
    Does this mean that an Upgrade to 8.1: SP5 or maybe even SP6 help, please?
    Would welcome any kind of advice/suggestions.
    Thanks you!!!!
    Rhishi.

    Rhishikesh Anandamoorthy wrote:
    Hi Joe,
    Thanks a lot for your reply.
    I should have mentioned in my previous post that the DBA had indeed recommended
    an increase to the Sybase's Procedure Cache Memory size. (We have a separate
    DBA team out here, and I do not have DBA access to my database).
    But I am a bit apprehensive on two counts:
    1. From the DB logs, I see that the query which seems to have failed is something
    which is fired day in and day out (though this involves the usage of temporary tables,
    which might have filled up the Cache). I should also add that the "DB statistics" was
    also being run (automatically) about the same time when the query failed. But again,
    the "DB statistics" is run everyday. So, cant see much of a problem here.Nevertheless, it is an internal DBMS issue.
    2. The CR179600 and CR183190 of the Weblogic Release Notes suggests that: "Under
    certain statement failure conditions, cached statements are leaked without being
    closed, which can lead to DBMS resource problems."
    So, I am just wondering if this is indeed the actual cause. If so, it might mean
    that there is a chance, though slight, that the problem might re-occur.
    There seems to be a fix for this in SP5.I certainly advocate upgrading to 81sp6, but that issue had to do with Oracle,
    which retains DBMS 'cursors' for each open prepared statement. This will have
    no effect on a Sybase DBMS.
    I can certainly upgrade to SP6. But, the application seems to have been pretty
    stable with SP2 for the past 4 years.
    I understand that an upgrade to SP6 may not be such a big change. But, it would
    still be a change.
    And the webapp which the server supports is very critical to our customer
    [which webapp is not? :-) ], and a server-restart again for this issue would
    certainly not be acceptable.
    So, would want to be doubly sure, if an upgrade is indeed the right way out.
    Thank you!!!
    Rhishi.In that case, I would stay comfortable with SP2 if you like. In my professional
    opinion, at this time, it is a purely DBMS-side issue, based on the current
    evidence. Note that the same WLS was fine for these same previous years. The
    problem may have to do with a gradual or recent change in the load or size of
    the DBMS.
    Joe Weinstein at BEA Systems ( nee [email protected] 1988-1996 )

  • Error 701, not enough procedure cache (*Urgent*)

    Hi All,
    Is there a SQL that I can use to determine the SPID that is the root cause of a 701 (not enough procedure cache)?
    Additional information:
    This is happening in 2 servers; 15G memory with 2G procedure cache and 10G memory with 1.25G procedure cache.
    Environment: Sun Solaris 10 running ASE 15.0.3 ESD#4
    Monitoring has been enabled.
    Sybase recommends either increasing the procedure cache or running dbcc proc_cache(free_unused) periodically.
    I would rather identify the process causing it or the configuration setting in these 2 environment that is causing this to happen.
    Thanks in advance.
    Anil

    Another thing you might try is the dbcc memusage command.  It will display the 20 biggest things in procedure cache, so if a few extraordinarily large cached procedures are the cause of the 701s, this may identify what the objects are.  It won't identify who first ran it, though, or even show if any spid is currently executing any of those 20 items.
    Example:
    1> set switch on 3604
    2> go
    Switch 3604 ('print_output_to_client') is turned on.
    All supplied switches are successfully turned on.
    1> dbcc memusage
    2> go
    Memory Usage:
                                       Meg.           2K Blks                Bytes
          Configured Memory:       156.2500             80000            163840000
    Non Dynamic Structures:         5.3751              2753              5636252
         Dynamic Structures:       123.1582             63057            129140736
               Cache Memory:         9.0098              4613              9447424
          Proc Cache Memory:        17.5703              8996             18423808
              Unused Memory:         1.1191               573              1173504
    Buffer Cache Memory, Top 8:
    Cache           Buf Pool        DB Id   Partition Id    Index Id         Meg.
    default data c                31515         8             0            0.0117
                          2K      31515         8             0            0.0117
    default data c                    1         8             0            0.0039
                          2K          1         8             0            0.0039
    default data c                    4         8             0            0.0039
                          2K          4         8             0            0.0039
    default data c                    2         8             0            0.0020
                          2K          2         8             0            0.0020
    default data c                    3         8             0            0.0020
                          2K          3         8             0            0.0020
    default data c                    5         8             0            0.0020
                          2K          5         8             0            0.0020
    default data c                   14         8             0            0.0020
                          2K         14         8             0            0.0020
    default data c                31514         8             0            0.0020
                          2K      31514         8             0            0.0020
    Procedure Cache, Top 20:
    Database Id: 31514
    Object Id: 121048436
    Object Name: sp_downgrade_esd
    Version: 1
    Uid: 1
    Type: stored procedure
    Number of trees: 0
    Size of trees: 0.000000 Mb, 0.000000 bytes, 0 pages
    Bytes lost for alignment 0 (Percentage of total: 0.000000)
    Number of plans: 1
    Size of plans: 1.217173 Mb, 1276298.000000 bytes, 628 pages
    Bytes lost for alignment 6488 (Percentage of total: 0.508345)
    Database Id: 31514
    Object Id: 905051229
    Object Name: sp_do_poolconfig
    Version: 1
    Uid: 1
    Type: stored procedure
    Number of trees: 0
    Size of trees: 0.000000 Mb, 0.000000 bytes, 0 pages
    Bytes lost for alignment 0 (Percentage of total: 0.000000)
    Number of plans: 1
    Size of plans: 1.080750 Mb, 1133248.000000 bytes, 582 pages
    Bytes lost for alignment 3674 (Percentage of total: 0.324201)
    Database Id: 31515
    Object Id: 1344004788
    Object Name: sp_dbcc_run_faultreport
    Version: 1
    Uid: 1
    Type: stored procedure
    Number of trees: 1
    Size of trees: 0.972553 Mb, 1019796.000000 bytes, 501 pages
    Bytes lost for alignment 4609 (Percentage of total: 0.451953)
    Number of plans: 0
    Size of plans: 0.000000 Mb, 0.000000 bytes, 0 pages
    Bytes lost for alignment 0 (Percentage of total: 0.000000)

  • Some general portal caching questions

    Hi experts,
    I have some general questions regarding caching functions in portal.
    1. In System administration->Navigation I can activate navigation cache. By default there are 3 connectors: Collaboration Connector, ROLES and gpn.
    I guess Collaboration Connector caches Collaboration Content and Roles caches the content of the Role-based navigation? Is that correct? What is gpn-connector?
    2. This cache does only cache the navigation structures? Not the iviews and the content?
    3. For some iViews and pages I can activate caching in PCD with certain cache levels. That caching is not related to navigation caching?
    4. I can't activate caching for web dynpro Java iviews and web dynpro java proxy pages. Is that corect? If not how can I achieve that. Those settings are deactivated for me, so I can't activate them.
    5. In Visual Admin I can activate navigation cache under com.sap.portal.prt.sapj2ee. Is this option related to the setting I can set under system administration->navigation in portal? Because I avtivated the option in portal but in VA it still showed it as not activated.
    I crawled some documentation but couldn't find exact information.
    Thanks and regards
    Manuel

    Hi,
    1. GPN is Guided Procedures Navigation connector
    2. Yes only Navigation nodes are cached (TopLevel and Detailed Navigation nodes)
    3. Here it is PCD Caching, which has nothing to do with Navigation caching
    4.  I never tried this, but It looks like what you say is true.
    5. What you see in VA is old caching mechanism. So this is obsolete and can be ignored.
        So you should only use the options from system administration->navigation
    Changes in the Navigation Cache
    Regards,
    Praveen Gudapati

  • Switching From Windows To Mac: ACR Database, Bridge Cache Questions

    I am planning to switch from Windows XP to the Mac running Leopard. I am now running CS2 in Windows, but will upgrade to CS3 on the Mac. I am maintaining my RAW file settings in ACR central database and my Bridge cache in a centralized cache file. I've searched the forums but couldn't find answers to my migration questions:<br /><br />1. Can one move the ACR database file from Windows (in folder C:\Documents<br />and Settings\<username>\Application Data\Adobe\CameraRaw) to a folder<br />somewhere on the Mac to preserve the settings on RAW files that are also<br />moved to the Mac? Or does one need to export individual XMP files for the<br />RAW files in Windows and move both the RAW files and their associated XMP<br />files to the Mac?<br /><br />2. I have a similar question for migrating the Bridge cache from Windows XP<br />to the Mac. Can one somehow move the Bridge cache over (I think it's in<br />C:\Documents and Settings\<username>\Application Data\Adobe\Bridge\Cache\Thumbnails\) or do I need to export the cache for<br />each folder and subfolder and move them over along with the folders and<br />subfolders?<br /><br />I would appreciate any help or pointers to any Adobe documents or<br />directions. Thank you.

    Man-Kong,
    Since you said that you were also migrating from CS2 to CS3 I would have said that their cache files were incompatible. That is what I experienced with CS1, CS2, and CS3 in the past. But Thomas indicated it should work. I must be missing something.
    The XMP files move fine for me. The local cache (folder) files have completely different names with each version and I see no evidence that they can be shared. This is also a problem with archived CDs. CS3 always has to rebuild cache if they were archived from CS1 or CS2.
    Since the central cache must have some folder references, and this structure will be completely different on Mac, I dont see how it can work. It doesnt work for scripts or actions either.
    So my humble recommendation is to set your preferences to store cache and XMP files in the local folders where possible. Then simply bite the bullet. Each time you visit a folder for the first time in the new environment, cache will be rebuilt.
    Cheers, Rags :-)

  • EP200 Certification Procedure, Interview Questions & Free Ebooks..

    hi all.
    I am planning to do EP certification on Administration..i heard that EP200 is Portal Administration and ADM200 is the pre-requisite for the EP200 certification, my question here is, do i need to get certified on ADM200 before getting certified on EP200 or i can do EP200 seperately..
    Is ADM200 is mandatory ?
    And, what is the procedure for taking up the certification like how can i pay for the cerifcation and what are the other procedures ?
    Any good sites for Interview questions & free EP200 pdf download ?
    Any help would be greatly appreciated and rewarded.
    Thanks!
    Addy

    Addy,
    ADM200 is not mandatory.
    It is advisable to take SAPEP before taking EP200, but it is not mandatory either.
    There are no SAP certifications associated with EP200, no exams or questions, etc.
    You attend the clas and get only a document of completion of the course.
    If you need to get EP SAP certificate, there are several available, like C_TEP_10_04s.
    Getting certified requires passing an exam and it is tough.
    You can find all the info here: http://www.sap.com/usa/services/education/index.epx
    In USA they take credit cards, you can call the toll free number and get registered for the course.
    Regards,
    Slava

  • Cache Question

    Hello all,
    I am not new to working with java (not writing it, just supporting it), but I'd like to know a little about this:
    I am currently working with a Java applet displaying TIF images that have been uploaded from another server. My question is about the Java cache. First of all, is it easy to find in the dir's? Everytime my applet loads a TIF image, what kind of files are being downloaded into the cache folder? What happens when cache folder has reached the maximum limit of memory that I have set? At that point, are files replaced with the current ones being downloaded, or is the cache no longer able to store files?
    I've been wondering this for some time now, so any help would be appreciated. Thanks!
    -adam

    ajetrumpet wrote:
    If you have a bad day, please don't respond. That's only fair to everyone, ya know?
    Thanks for the replies, or lack thereof, but I think this thread is pretty much useless now...thanks again for anything you guys helped with.I've had a great day, thanks, but if you look at this thread through the eyes of most of us here, you're coming off, well, not looking so good, kind of (and I hate to say it) like a spoiled brat. Is that how you want to appear? Seriously, think on how your reply will appear to others, not just the person you're arguing with. This is being posted with the intention of helping you get better answers in the future. Also, read this link here that tells you how to ask decent questions, questions that others will want to answer: [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html]
    good luck.

  • Cfquery caching question

    I have a question (actually two) about how caching works with cfquery so I can make sure that what I'm doing on our website makes sense. (We're on CF10)
    I have a database that stores certain details about each of the web pages on our site.  Contact ID, title, date added/updated, whether it's a recent or featured item, etc.  The unique identifier for each page is the path (/folder/subfolder/page.cfm).  Since out site is organized in several major topic areas, there's a column to identify which topic the page is in (and that's the same as the folder name that set of pages resides in).
    Some or topics get tons of hits, and some get very few, so I've been doing this:
    <cfquery name="getalltopics" datasource="dsn" cachedwithin="#createtimespan(0,1,0,0)#">
    SELECT (columns I need
    FROM pages
    WHERE topic = <cfqueryparam value="#topicname#"  cfsqltype="cf_sql_varchar">
    </cfquery>
    <cfquery name="getpagedetails" dbtype="query">
    SELECT (columns I need)
    FROM getalltopics
    WHERE page_id = <cfqueryparam value="#page_path#"  cfsqltype="cf_sql_varchar">
    </cfquery>
    So here's my question.  I know that caches only come into play if the query that's being run identically matches the one that's cached. So in my mind, the fist query would make an individual cache of each of our topics, as the pages were viewed during the day.  My second cache would grab the page details from the first, with several topics cached, how would the second one know which cache to find the page details in?  The query works, and is fast, but I'm just wondering if I need to specify the topic ID in the second query.
    My second question is about cache time.  If I do createtimespan(0,1,0,0), does that cache last for an hour after it's created, or does it last for an hour after the last time that query is run?
    Thanks!

    What I ended up doing was creating a variable-based query name, named after the current topic, like so:
    <cfset qname = "q" & topic_name>
    <cfquery name="#qname#" datasource="dsn" cachedwithin="#createtimespan(0,1,0,0)#">
    SELECT (columns I need)
    FROM pages
    WHERE topic = <cfqueryparam value="#topicname#"  cfsqltype="cf_sql_varchar">
    </cfquery>
    <cfquery name="getpagedetails" dbtype="query">
    SELECT (columns I need)
    FROM #qname#
    WHERE page_id = <cfqueryparam value="#page_path#"  cfsqltype="cf_sql_varchar">
    </cfquery>
    This way I (in theory) have a unique cache for each topic, and my second query draws from that cache.
    Upon implementation, I've noticed a significant reduction in database hits (since we still use Access on this site, any hit creates an .ldb file, so I can easily tell if it's getting hit).  Prior to the change, the ldb file was basically continuously there, appearing and reappearing a few times per second.  Now, several minutes can go by with no ldb, even at the peak of the day, and pages are getting rendered almost instantly.  If I add up all my query execution times for a page, I'm getting 5-7 ms total.
    So it has to be doing something.

  • Simple Query Caching Question

    I have a .cfm template that is used to render a handful of
    pages of my website. Each page is a department, for example, like
    "Arts & Entertainment", "Health", "Finance", and so on. On each
    of these pages (rendered by this same template) there is a common
    element... a list of our top ten articles. I have used the
    "cachedwithin" feature to cache the query for a 3-hour period.
    My question is this...
    Since it is a single template generating these department
    pages, the "top articles" query is exactly the same in terms of
    query name, datasource... only the SQL statement (which uses a
    "WHERE department_id = X" statement) is different. Let's say I have
    ten departments rendered by this template... should it be caching
    all ten queries, regardless of the names being the same?

    Hopefully you only have one cfquery tag and it is located in
    the .cfm template and you are using a variable in your where
    clause. If not, you are not being efficient with your code.
    If you do have just one cfquery tag, and you have a
    cachedwithin attribute, cold fusion will cache a query each time
    your variable changes.

  • Result cache question

    I create and populate the following table in my schema:
    create table plch_table (id number, time_sleep number);
    begin
      insert into plch_table values (1, 20);
      commit;
    end;
    Then I create this function (it compiles successfully, since my schema has EXECUTE authority on DBMS_LOCK):
    create or replace function plch_func
      return number
      result_cache
    is
      l_time_sleep number;
    begin
      select time_sleep
        into l_time_sleep
        from plch_table
       where id = 1;
      dbms_lock.sleep(l_time_sleep);
      return l_time_sleep;
    end;
    I then start up a second session, connected to the same schema, and execute this block:
    declare
      res number := plch_func;
    begin
      null;
    end;
    Within five seconds of executing the above block, I go back to the first session and I run this block:
    declare
      t1 number;
      t2 number;
    begin
      t1 := dbms_utility.get_time;
      dbms_output.put_line(plch_func);
      t2 := dbms_utility.get_time;
      dbms_output.put_line('Execute in '||round((t2-t1)/100)||' seconds');
    end;
    what will be displayed after this block executes?
    And the result is:
    20
    Execute in 30 secondsHowever, I don't understand why? I mean what is going on behind this? Why the result 30? Could somebody tell me why?

    Honestly, before yesterday's PL/SQL Challenge question, I had no idea how this worked either. This is very much a deep internals question-- you'd likely have to go looking for a very specialized presentation or blog post to get more detail (or you'd have to do the research yourself). And even then, it's relatively unlikely that they would go into much more detail than the PL/SQL Challenge answer did. Julain Dyke's Result Cache Internals (PPT) is probably one of the more detailed presentations about the internals of the result cache.
    The set of valid statuses for a result cache object are documented in the Oracle Database Reference entry for the v$result_cache_objects view. The two 10 second timeouts are controlled by the database- and session-level settings of the undocumented resultcache_timeout parameter (which, based on this blog post by Vladimir Begun was set to 60 seconds in 11.1.0.6 and changed to 11.1.0.7 to 10 seconds.
    Justin

  • SQL Cache/Procedure Cache Limit

    Does anyone know if there is a memory limit for cache memory of a table? The reason for me asking is that I have an stored procedure that returns a ORA-22813. It appears that the in cache table memory has reached its full capacity (30K). Is there a way to increase cache table size?

    Does anyone know if there is a memory limit for cache memory of a table? The reason for me asking is that I have an stored procedure that returns a ORA-22813. It appears that the in cache table memory has reached its full capacity (30K). Is there a way to increase cache table size?

  • Explain plans - caching question

    I am trying to get some explain plan information for some queries that we have running poorly. Our application uses some alter session statements to set the optimizer_mode to all_rows. I am trying to determine if we need to include the optimizer_index_cost_adj parameter and possibly the optimizer_index_caching parameter.
    Using SQL Developer I can easily run the different alter session statements needed and then get an explain plan for the query in question. However I am seeing some weird results - for example long query times for queries that have a relatively low cost. On the flip side I am seeing some queries that have a higher cost return quicker.
    I am doing this many times over and am wondering what impact using the same query could have. Is this query being cached in Oracle? To get an accurate explain plan would I need to clear a cache each time?
    Also, in the explain plan is the cost figure the most important? How is it that a query can have a low cost and take longer to complete than the same query with a higher cost and some different parameters?

    There are no fixed road map for what to see in explain plan,but some common observation should be made for explain plan i.e full table scans due to poor use of indexing,inappropriate hints uses for forcing indexing where FTS can be faster.unnecessary sorting,cartesian
    joins, outer joins, and anti-joins.
    At last i would say that every database vary to its different hardware platforms and those hardware have different configuration,these things can effect oracle optimizer.
    So, if my statistics are current, what should I be
    taking out of the explain plan? I always assumed
    cost was the main indicator of the performance of a
    query.As justin already told cost is not something which should be considered for tuning query rather access path, but there is more other then explain plan access path e.g TKPROF tool which will address you plan as well as others stuff which should be considered for tuning query.
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htmKhurram

  • Testing stored procedures - stupid question

    Ok here is a stupid question.. I have a stored procedure that returns 3 refcursors. When I call the procedure from code (C#), everything works fine.. however, I want a way to review the output of the stored procedure in Oracle Sql Developer before I test it in code. I can run it, but I can't figure out a way to display the records in the refcursors, =D

    Well I am really looking for syntax help.. sql server developer here, used to things being easier.. here is my procedure signature from running it in sql developer:
    DECLARE
    CONSUMETYPE NUMBER;
    RESULTS SYS_REFCURSOR;
    RESULTS2 SYS_REFCURSOR;
    RESULTS3 SYS_REFCURSOR;
    BEGIN
    CONSUMETYPE := NULL;
    USP_SELECT_PROMOTIONS(
    CONSUMETYPE => CONSUMETYPE,
    RESULTS => RESULTS,
    RESULTS2 => RESULTS2,
    RESULTS3 => RESULTS3
    -- Modify the code to output the variable
    -- DBMS_OUTPUT.PUT_LINE('RESULTS = ' || RESULTS);
    -- Modify the code to output the variable
    -- DBMS_OUTPUT.PUT_LINE('RESULTS2 = ' || RESULTS2);
    -- Modify the code to output the variable
    -- DBMS_OUTPUT.PUT_LINE('RESULTS3 = ' || RESULTS3);
    END;
    Where it says "Modify the code to output the variables".. It gives me a compile error when uncommenting those lines, and I am assuming because it cannot output a cursor that way, so I am trying to find a way to just output the cursor to a grid or text pane?

Maybe you are looking for

  • Navigation works in IE but not Firefox or Safari!

    Hi guys Why do my nav links on the hompage work in IE but not in Firefox and Safari? http://www.jasonkieck.com/ Any help would be appreciated

  • New Page in ALV GRID display.

    HI Experts, I have a requirement of displaying top of page and corresponding detailed records for specific combination of top of page(say plant,material,batch etc). Again for the next combination I need repeated header and detail list. I guess I have

  • Generic Data source Issue with Infoset

    Hi Experts, I have created generic data source with Infoset.As per customer requirement, I have to modify join condition between tables from equal to left outer join in infoset.I have tested scenario successfully using infoset query. I have done belo

  • I get an error when loading LR to Macbook Pro using Leopard.

    I now have a Macbook Pro with Leopard and wanted to load my Lightroom 2 that I only have on my pc desktop and then get the upgrade for it on the MBP but I get an error failure and do not know where to go from here to find out what the problem is. 

  • HT4972 iOS 4.2.1 update to iOS 5 or later

    How do you erase and restore your IPAD before completing update from 4.2.1 to iOS 5 or later?