Gather_table_stats with a method opt of "for all indexed columns size 0"

I have 9 databases I support that contain the same structure, and very similar data concentrations. We are seeing inconsistent performance in the different databases due to bind variable peeking.. I have tracked it down to the Min and Max values that are gathered during the analyze. I analyze from one cluster, and export/import those statistics into the other clusters.. I then go about locking down the stats gathered. Some of the statistics are on tables that contain transient data (the older data is purged, and new data gets a new PK sequence number).
Since I am gathering statistics with a 'FOR ALL INDEXED COLUMNS SIZE 1', a min and max value are grabbed. This value is only appropriate for a short period of time, and only for a specific database. I do want oracle to know the density to help calculate, but I don't want cardinality based on whether the current bind values fall in this range..
Example
COLUMN PK
When I analyze the min is 1 and max is 5. I then let the database run, and the new min is 100 and max is 105.. same number of rows, but different min/max. At first a select * from table where pk>=1 and pk <=5 would return a cardinality of 5.. Later, a seelct * from tables where pk>=100 and pk<=105 would return a cardinaility 1.
Any ideas how to avoid this other than trying set min and max to something myself (like min =1 max = 99999999). ??

MarkDPowell wrote:
The Oracle documentation on bind variable peeking said it did not peek without histograms and I cannot remember ever seeing on 9.2 where the trace showed otherwise. Mark,
see this simple test case run on 9.2.0.8. No histograms, but bind variable peeking, as you can see that the EXPLAIN PLAN output generated by AUTOTRACE differs from the estimated cardinality of the actual plan used at runtime.
Which documentation do you refer to?
SQL>
SQL> alter session set nls_language = 'AMERICAN';
Session altered.
SQL>
SQL> drop table bind_peek_test;
Table dropped.
SQL>
SQL> create table bind_peek_test
  2  as
  3  select
  4             100 as n1
  5           , cast(dbms_random.string('a', 20) as varchar2(20)) as filler
  6  from
  7             dual
  8  connect by
  9             level <= 1000;
Table created.
SQL>
SQL> exec dbms_stats.gather_table_stats(null, 'bind_peek_test', method_opt=>'FOR ALL COLUMNS SIZE 1')
PL/SQL procedure successfully completed.
SQL>
SQL> variable n number
SQL>
SQL> variable n2 number
SQL>
SQL> alter system flush shared_pool;
System altered.
SQL>
SQL> exec :n := 1; :n2 := 50;
PL/SQL procedure successfully completed.
SQL>
SQL> set autotrace traceonly
SQL>
SQL> select * from bind_peek_test where n1 >= :n and n1 <= :n2;
no rows selected
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1000 Bytes=24
          000)
   1    0   FILTER
   2    1     TABLE ACCESS (FULL) OF 'BIND_PEEK_TEST' (Cost=2 Card=100
          0 Bytes=24000)
Statistics
        236  recursive calls
          0  db block gets
         35  consistent gets
          0  physical reads
          0  redo size
        299  bytes sent via SQL*Net to client
        372  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          4  sorts (memory)
          0  sorts (disk)
          0  rows processed
SQL>
SQL> set autotrace off
SQL>
SQL> select
  2             cardinality
  3  from
  4             v$sql_plan
  5  where
  6             cardinality is not null
  7  and      hash_value in (
  8    select
  9            hash_value
10    from
11            v$sql
12    where
13            sql_text like 'select * from bind_peek_test%'
14    );
CARDINALITY
          1
SQL>
SQL> alter system flush shared_pool;
System altered.
SQL>
SQL> exec :n := 100; :n2 := 100;
PL/SQL procedure successfully completed.
SQL>
SQL> set autotrace traceonly
SQL>
SQL> select * from bind_peek_test where n1 >= :n and n1 <= :n2;
1000 rows selected.
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1000 Bytes=24
          000)
   1    0   FILTER
   2    1     TABLE ACCESS (FULL) OF 'BIND_PEEK_TEST' (Cost=2 Card=100
          0 Bytes=24000)
Statistics
        236  recursive calls
          0  db block gets
        102  consistent gets
          0  physical reads
          0  redo size
      34435  bytes sent via SQL*Net to client
       1109  bytes received via SQL*Net from client
         68  SQL*Net roundtrips to/from client
          4  sorts (memory)
          0  sorts (disk)
       1000  rows processed
SQL>
SQL> set autotrace off
SQL>
SQL> select
  2             cardinality
  3  from
  4             v$sql_plan
  5  where
  6             cardinality is not null
  7  and      hash_value = (
  8    select
  9            hash_value
10    from
11            v$sql
12    where
13            sql_text like 'select * from bind_peek_test%'
14    );
CARDINALITY
       1000
SQL>
SQL> spool offRegards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/

Similar Messages

  • What value for DBMS_STATS method_opt= 'for all indexed columns ???'

    What value, one should use for method_opt , while collecting stats for database/schema/table.
    It is obseverd AUTO never give good result, in some case "for all indexed columns 1" work fine and some case "for all indexed columns 254".
    Please advise , what is right way to collect stats.
    OS : Linux AS 4
    DB : 9.2.0.8 , 10.2.0.3
    Thanks

    Gather AUTO. Gathers all necessary statistics automatically. Oracle implicitly determines which objects need new statistics, and determines how to gather those statistics. When GATHER AUTO is specified, the only additional valid parameters are stattab, statid, objlist and statown; all other parameter settings are ignored. Returns a list of processed objects.
    If you specify the for all indexed columns, or specify the column, it will gather histograms. Those are useful if you have an uneven data distribution, and are specially useful for DSS databases, where Oracle will determine if a column is suitable, on a given data rage, to perform full table scan or index scan. If uncertain about it I suggest you not to gather column statistics, as they are costly.
    ~ Madrid.

  • I purchased lightroom 5.  do I open this box or go with the black friday sale for all

    I purchased lightroom 5.  do I open this box or go with the black friday sale for all?  what happens next year after spending $9.99 a month without a disc for lightroom? does the monthly fee just continue?

    does the monthly fee just continue?
    Yes, with subscription products, if you want to keep using them, you keep paying the monthly fee.
    All updates and upgrades (e.g. LR6, LR7) are included in your membership but you never get to a point where you can stop paying and own the software.
    If you want to pay once and own the software then use the perpetually licensed version that you've already bought. You'll then have to pay again to upgrade to future versions such as LR6.

  • Do I need to export multiple sizes for all standard print sizes? i.e.Say I crop the image in LR to 6'5" x 9' to fit within an 11" x 14" (overall) mat of a framed print.. Now let's say I want to reprint that same image in a 12" x 16" size ... to fit within

    Do I need to export multiple sizes for all standard print sizes? i.e.Say I crop the image in LR to 6'5" x 9' to fit within an 11" x 14" (overall) mat of a framed print.. Now let's say I want to reprint that same image in a 12" x 16" size ... to fit within a mat of with overall size of 20" x 24"? Or will the 1st export be "locked" at 6.5" X 9" (proportionately)?

    So, for the first one Export it cropped to 6.5 x 9 - and in the Export Dialog box there is a capability to rename the file for exported output - which would allow you to add something like the crop or intention to the base name of the file.  e.g. for _IMG0846.nef - setup the output filename to _IMG0846-65x9 for 11x14.jpg and output it at, say 300 or 360 dpi.  So, it has a unique name and purpose in your output folder.
    For best results, now, re-crop the picture in LR - just open the crop [R] dialog again, reframe the image to the new ratio, 12x16 and Export again - with an adjustment to the filename. e.g. _IMG0846-12x16 for 20x24.jpg
    So, now you have two clearly identified image files in your output area and you can provide those to whomever is printing for you, etc.  Discard them when you're done since you always have the original to return to to re-frame again as necessary.
    This way you get output sharpening and resolution (in pixels) optimized for your output print size.  Maybe not super important for smallish prints-but more important for larger ones.   Output at 100 quality.

  • Set logging to NO for all index in primary DB

    Hi,
    can i set the logging option to NO for all index in primary DB (versus standby DB).
    Because the execute plan of queries changes with this option and the time it's very long for geats tables if the option logging it's YES.
    Regards.

    Hi,
    personally I have never seen that execution plan changes if objects in nologging mode. Could you show sql statements that have changed execution plans due to nologging clause.
    Thanks,
    Andrey

  • FBZP Payment method ranking order for all currencies

    Hello,
    Does anybody know if it's possible to setup the ranking order and the bank accounts in FBZP, so that the payment method can be run for all currencies?  Presently I have the payment method setup for CAD and USD, but the business wants to be able to run it for all currencies.  Is this possible without having to enter a 'method' and 'currency'  record for every single currency in SAP?   That would take over 100 manual entries.
    thanks for your help
    Brett Lilyquist

    Dear Brett Lilyquist,
    As far as I know, the functionality your required is not avaliable in SAP standard. You have to customize it one by one if all currencies are necessary.
    Sorry no positive solution provided.
    Best Regards,
    Gladys

  • My browser displays text only with very little page formating for all pages. How do I enable page formating with images etc.?

    I have a multi-user windows based machine where both users have the same browser, search engine, plugins, applications, etc. I use this machine primarily as an entertainment system (ie. TV client/server using a TV Tuner card, Music & Video Player, etc.). Most of my time on this machine is maintaining security and drivers. However, my wife uses it primarily as a social media communication device. My user account on this machine displays all content correctly. Where as she has crashed both Facebook games while playing as well as her mail (GMail). After one of these crashes it "appears" she is displaying HTML text with formatting but without images. I've tried to fix this without success. We have another machine that seems fine so it's not her login on our network, just the one machine. Please help!!!

    You can try these steps in case of issues with web pages:
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Blue Lego with question mark showing up for all my attachments and images

    Something happened. I don't know if it was from installing the new Adobe flash. Now all my jpegs, pngs, file attachments show up as blue legos with a ?. But stuff form Amazon, eBay have images showing. same goes for jpegs sent to me from friends. what happened?

    I have been experiencing the same issues. So far, I have tried:
    1. Uninstall Flash with the Uninstaller supplied on Adobe's website. Reinstall Flash. _Did not work_.
    2. Uninstall Flash with the Uninstaller supplied on Adobe's website. Delete the ~/Library/Preferences/com.apple.quicktime.plugin.preferences.plist. Reinstall Flash. _Did not work_.
    3. The suggestions posted on MacFixIt at: http://www.macfixit.com/article.php?story=20071204103141963. _Did not work_. In fact, on my Mac there is not a "application/x-shockwave-flash" entry shown under "WebPluginMIMETypes." It might be that it should be there, but its not. If its needed, I don't know how to get it there. Even reinstalls of Flash Player don't put it there. (I did not try fix #3 because I don't want to break Quicktime).
    Basically, I have tried everything I can find and still am not able to fix this issue in Safari. It works ok in Firefox, but not always. Sometimes I get a blank box or two in Firefox where a picture should be. I especially have this issue when using Facebook.
    Seem like many others are running into these issues. I really wish Apple and Adobe would get their act together on things. I am fairly new to Macs and I'm beginning to believe with all the quirks and bugs that Apple has shown me since I've been running Leopard, that Macs are not really much better than PCs. The user experience is better, but in terms of stability, not much better.
    If anyone has any other suggestions, I'm all ears.
    iMac Aluminum
    Mac OS X 10.5
    Safari 3.0.4 (5523.10.6)
    Message was edited by: KensethFan
    Message was edited by: KensethFan

  • Publishing a list with specifics views anf filters for all the users to see it.

    Hi i was working on the item level permissions of a list which are accessed by all users.
    I have applied the item level permissions for specific users having specific records to work with.
    Now, there are situations when we need to show all the users all the data but in read only mode.
    How do i work on the report so that the user can actually only see the data.
    The Admin will pick the list with a specific view and apply filters and then expose it for other end users to view.
    How do i achive that?

    Hello,
    How did you set item level permission? I mean,  list "advanced settings" OR manually edit the items permission by breaking the permission.
    If you have broken the permission and user doesn't have permission on  items then there is no way to show item to users. You must provide at least read access to view the item.
    In you case, you can give contributor right to everyone on all items (by inherit parent permission) then go to list settings page-->advanced settings-->then set item level permission as shown in pic:
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Problem with getDefinition method in ApplicationDomain for iOS AIR app

    I was using getDefinition method in ApplicationDomain to get class definition of an exported symbol from an external swf. It used to work fine with debug builds even on iOS. But when i exported a release build and installed the ipa file on iPad it stopped working. I debugged and found out that getDefinition is returning null in case of release builds on iPad.
    Is it a known issue? If yes, is there any workaround present ?

    Fast packaging in Flash Builder internally uses interpreter mode.
    The "Export Release Build" option generates an AOT build which uses ipa-app-store. For more on different target types in AIR iOS, refer:
    http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d128cdca935b-8000.html
    When you export some symbol (in say Flash Pro via AS Linkage), actionscript byte code is inserted in your SWF. As this SWF hasn't been AOTed, you are not able to access the symbols in it in a release build. Presently there is no way to AOT external swfs. Using the currently available tools, your best bet is to create a single SWF and then "export release build"

  • Petition: Compatability with Audible Audiobooks .aa format for all Creative play

    I would like to see a firmware upgrade that would allow my Zen Touch and all Creative players to take advantage of the wide selection of audiobooks available on audible.co.uk. If you agree with me, sign below!

    I have noticed this problem also. Starting happening after 2.1 upgrade, only noticed it with audible files. It sounds like it is playing it faster. I found pausing and moving forward or back even one second fixes it. Just pauses does not fix the problem. I usually download with format 3 from audible.

  • How to Export VO query data for all the columns.

    Hi All,
    I have advanced Table where i will be displaying only few of the columns from the VO query, when i export it will display only those columns which are displayed in advanced Table, so is it possible to export other columns also?
    Thanks
    Babu

    I faced this similar issue ...as per my knowledge if the widget for the underlying VO attribute is rendered then only one can export the data...a possible workaround is..u can create a similar page showing the respective columns intended to be exported and redirect to tht page and export it from there .....

  • Why does the DB Tools List Columns.vi only report -1 for the defined column size?

    I am using LabVIEW 8.2.1 with the database connectivity toolset with an SQL Server 2000 database. I would like to see how large a full record could be, so I used the DB Tools List Columns.vi in the database toolset. It easilly displays the column name and the column type, but only returns a -1 for the defined size. Of course when I add up the defined size elements, it gives me -351, which is the number of columns in that particular table. The vi I am using is very simple. I open a database connection, retrieve the data, and close the connection. The retrieved data is an array of clusters. I index it by running it through a for loop, and unbundeling each of the three parameters, and reforming arrays at the end of the for loop. This is as about the simplest vi I have ever made, but only part of it works.
    Attachments:
    Table size.vi ‏23 KB

    SciManStev-
              I don't know if this gets you the functionality you want because I don't have access to your file, but I would have code it this way (see attached picture). I would have used a Array to Cluster.vi to convert the column info ouput array into a cluster so I could use Unbundle by name. I think this is what you are wanting because from what I see, you only access the file once everytime the VI runs (right?). Try this and let us  know how it works out. Thanks!!
    Grant H.
    National Instruments
    LabVIEW Product Marketing Manager
    Attachments:
    untitled.JPG ‏29 KB

  • Execute Webdynpro4Abap Application with same ERP-User for all portal-users?

    Hi,
    is it possible to let a Webdynpro4Abap application run with only one ERP-User for all portal-users? Therefore not needing an ERP-license for every portal-user?
    Somekind of mapping maybe?
    Regards
    Jan

    Jan,
    It is possible but it all depends on the type of application .If you want to show same data for all users you can use one user but if data is different for all users then you cannot go with this approach.
    to configure single backend user for your application go to tcode SICF and look for that application and go to logon data tab by double clicking and give one common user details
    Thanks
    Bala Duvvuri

  • Block all websites apart from the homepage for all users. Citrix environment with Server 2003.

    Citrix Xenapp 5 and Windows server 2003 environment. We want to force Firefox to kiosk mode with a pre-set homepage for all users. I also want to lock this to only one website. I have managed to set up the kiosk mode with R-Kiosk addon and Mozilla.cfg file. I am trying to use BlockSites to block all internet sites and only allow the one site with the whitelist option. I can get the addon to install for all users, but can’t get the default settings across. I have tried to add this with the Mozilla.cfg file, but it looks like this addon is getting it’s settings from the profile folder. If I set the preferences for the addon in Mozilla,cfg file, it actually picks it up but it doesn’t apply it to the addon for some reason. Does anyone have any other ideas on how I can lock this down to the one site?

    I am not entirely sure how to do this, but the enterprise community would be a good place to ask. They have a email group you can ask on this page: [https://www.mozilla.org/en-US/firefox/organizations/faq/]

Maybe you are looking for

  • I cant seem to restore my iphone from my computer backup i did lastnight?

    it only gives me the option to back up, not to restore, but on my screen is displayed: Latest backup: yesterday 19:36 to this computer. Help?

  • Free Goods  based on order value

    Hello, We would like to setup a new promo - if your order exceeds $X, get a specified material for free. Is it possible to setup and how? Thank you for all your help! Mila.

  • Wont connect to itunes when plugged in

    My phone is brand new. When I plug it into the computer to sync my music it doesn't show up. The computer makes a noise when I plug it in and when I unplug it but the picture extract screen as well as iTunes doesn't ever show up. Is there some way to

  • Persistent cookies not staying persistent!

    I'm a web developer and I use cookies on some of my sites to add to the functionality, for example: In an e-commerce site remembering to display only [User selected amount] of products instead of [All the products ] at once, depending on what the use

  • How to run report from form using run_object_report

    I AM USNING FORMS9I/REPORTS 9I , HOW TO RUN REPORT FROM FROM USING RUN_REPORT_OBJECT AND HOW TO PASS PARAMETER AS WE DID IN RUN_REPORTS PLEASE HELP ME