Select Performance problems using the 'like' operator

I have a PL/SQL procedure that uses a cursor which contains a 'like' operator in the where clause. I have two database instances that are theoretically the same, however this code processes about 100,000 rows in 5 minutes on one database and 100,000 rows in several weeks on the other database. I know it is the 'like' operator that is causing the problem, but I don't know where to look in the database setup parameters as to what could be different between the two. Can someone point me in the right direction?

I tried to think of another way to write the query, but I really need to use the wildcard option on the data I'm searching for. The system I'm working with attaches a suffix to the end of every ID (ie. '214-222-1234-0') The suffix ('-0') increments but the rest of the ID stays the same ('-1','-2',etc...), but I want to find all of the rows where the first 12 characters are the same, so I strip off the suffix and use a wildcard '%' in its place. I tried adding the SUBSTR() function to the left hand column of the where clause, but it was even slower than using the 'like' operator. I know its a sound query, I just can't figure out why it works fine on one database and not the other.

Similar Messages

  • Cm:select performance problem with multiple likes query clause

    I have query like <br>
              <b>listItem like '*abc.xml*' && serviceId like '*xyz.xml*'</b><br>
              Can we have two likes clauses mentioned above in the cm:select. The above is executing successfully but takes too much time to process. <br><br>
              Can we simplify the above mentioned query or any solution. Please help me in this issue.<br><br>
              Thanks & Regards,<br>
              Murthy Nalluri

    A few notes:
    1. You seem to have either a VPD policy active or you're using views that add some more predicates to the query, according to the plan posted (the access on the PK_OPERATOR_GROUP index). Could this make any difference?
    2. The estimates of the optimizer are really very accurate - actually astonishing - compared to the tkprof output, so the optimizer seems to have a very good picture of the cardinalities and therefore the plan should be reasonable.
    3. Did you gather index statistics as well (using COMPUTE STATISTICS when creating the index or "cascade=>true" option) when gathering the statistics? I assume you're on 9i, not 10g according to the plan and tkprof output.
    4. Looking at the amount of data that needs to be processed it is unlikely that this query takes only 3 seconds, the 20 seconds seems to be OK.
    If you are sure that for a similar amount of underlying data the query took only 3 seconds in the past it would be very useful if you - by any chance - have an execution plan at hand of that "3 seconds" execution.
    One thing that I could imagine is that due to the monthly data growth that you've mentioned one or more of the tables have exceeded the "2% of the buffer cache" threshold and therefore are no longer treated as "small tables" in the buffer cache. This could explain that you now have more physical reads than in the past and therefore the query takes longer to execute than before.
    I think that this query could only be executed in 3 seconds if it is somewhere using a predicate that is more selective and could benefit from an indexed access path.
    Regards,
    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/

  • Using the LIKE operator

    How do I create a search parameter LIKE for a name?  I wrote this, and it's pulling in all the names, instead of only searching for whatever I entered in.  What did I do wrong?  Please help.
    {table.name_last} like ["*", {?Last Name}]
    Thank you,
    T

    I have never seen it written like this.  Are the * entered in the parameter selection?
    {table.name_last} like \"*\", {?Last Name}
    What does
    do in the formula?

  • Using the LIKE operator with wildcards to match names

    I am using SQL in ColdFusion 9 to match names in an MS Access 2003 database table.
    The Visitors field of MyTable contains the name "Smith" in six records.
    1. Smith Jones Wilson
    2. Smith, Jones, Wilson
    3. Smith(Jr.), Jones, Wilson
    4. Jones Wilson Smith
    5. Wilson Smith Jones
    6. Smith
    7. Smithson, Jones, Wilson
    8. Jones, Wilson, Arrowsmith
    To find out which records contain the name Smith (but not Smithson or Arrowsmith) I now need to write four "OR" lines:
    WHERE MyField LIKE 'Smith[!a-zA-Z]%'  (finds only the Smiths in records 1, 2 and 3)
             OR MyField LIKE '%[!a-zA-Z]Smith'  (finds only the Smith in record 4)
           OR MyField LIKE '%[!a-zA-Z]Smith[!a-zA-Z]%' (finds only the Smith in record 5)
           OR MyField = 'Smith'   (finds only the Smith in record 6)
    I would like to know how to combine these four lines into one which would find all six records containing Smith.
    Thank you for your help.

    As this is a SQL-specific question, you might be better off asking it on a SQL forum?  Does Access even support regexes?
    For a CF the regex you'd be after "\bsmith\b".  You should read the Access regex reference to see if it supports this.  A CF regular expression is no use to you here as the comparison needs to be done on the DB,  not in CF.
    Adam
    Misread the question.  Revising.

  • Performance problem using OBJECT tag

    I have a performance problem using the java plugin and was wondering if anyone else was has seen the same thing. I have a rather complex applet that interacts with java script in a web page using the LiveConnect API. The applet both calls javascript in the page and is called by java script.
    Im using IE6 with the java plugin that ships with the 1.4.2_06 JVM. I have noticed that if I deploy the applet using the OBJECT tags, the application seems the trash everytime I call a java method on the applet from javascript. When I deplot the same applet using the APPLET tag the perfomance is much better. I would like to use the OBJECT tag because it applet bahaves better and I have more control over the caching.
    This problem seems to be on the boundaries of IE6, JScript, the JVM and my Applet (and I suppose any could be the real culprit). My application is IE5+ specific so I can not test the applet in isolation from the surround HTML/JavaScript (for example in another browser).
    Does anyone have any idea?
    thanks in advance.
    dennis.

    I have a performance problem using the java plugin and was wondering if anyone else was has seen the same thing. I have a rather complex applet that interacts with java script in a web page using the LiveConnect API. The applet both calls javascript in the page and is called by java script.
    Im using IE6 with the java plugin that ships with the 1.4.2_06 JVM. I have noticed that if I deploy the applet using the OBJECT tags, the application seems the trash everytime I call a java method on the applet from javascript. When I deplot the same applet using the APPLET tag the perfomance is much better. I would like to use the OBJECT tag because it applet bahaves better and I have more control over the caching.
    This problem seems to be on the boundaries of IE6, JScript, the JVM and my Applet (and I suppose any could be the real culprit). My application is IE5+ specific so I can not test the applet in isolation from the surround HTML/JavaScript (for example in another browser).
    Does anyone have any idea?
    thanks in advance.
    dennis.

  • I am not getting any sound input on my microphone. There is no microphone input on my new macbook pro, so I am using my old one. Is this a problem with the new operating system? Did they simply remove any microphone software?

    I am not getting any sound input on my microphone. There is no microphone input on my new macbook pro, so I am using my old one. Is this a problem with the new operating system? Did they simply remove any microphone software?

    Check System Preferences > Sound > Output
    Make sure the correct device is selected.

  • I am having a problem changing a color in a selected area. Using the Quick Selection tool I am able to select the area I wish to change. Using the Brush tool, color, color mode and click drag in my selected area, nothing happens, no color changes.   I hav

    I am having a problem changing a color in a selected area. Using the Quick Selection tool I am able to select the area I wish to change. Using the Brush tool, color, color mode and click drag in my selected area, nothing happens, no color changes. I have viewed some videos and read numerous articles but haven't found the one to help me. Please point me in the best direction. Thank you Vincent TC

    For the sake of clarity and to save people time, Todd is asking about the behaviour of the Patch tool when using it to repair the area next to the young lad's head.  Todd gets a blurred dark tone pretty much regardless of the options he uses.
    IMO that's what I would expect to happen because of the close proximity of the other image elements i.e. the lad's neck and the strong lines of his shirt.  I would not choose to use the Patch tool in this situation.  Content Aware Fill makes a better stab at it. 

  • Having trouble importing individual songs on a CD.  Instructions say to select/deselect songs using the check marks by song titles, but they are not there. never had this problem in older versions.  Help Please

    having trouble importing individual songs on a CD.  Instructions say to select/deselect songs using the check marks by song titles, but they are not there. never had this problem in older versions.  Help Please

    Are you saying that the tick-box shown in my screenshot, isn't there? (Yes, this is iTunes 11 - I've turned on the sidebar and the Menu bar. So you can see, this is a CD in my drive that we're looking at.)
    If it isn't, go to Edit/Preferences/General and turn on the tick-box box
    You can show the Menu Bar (with Edit on it) by using CTRL + B

  • The new ibook app and ibook update is designed for iPhone 5 operating system.   When my iPhone4 recently updated the ibook app, it created many problems using the ibook to download and read my books.    Can I get the previous ibook app back on my phone.

    The new ibook app and ibook update is designed for iPhone 5 operating system.   When my iPhone4 recently updated the ibook app, it created many problems using the ibook to download and read my books.    Can I get the previous ibook app back on my phone.

    Check your trash can on the desktop. The old version is automatically moved to the trashcan. You should be able to move it from the trashcan back to the Apps folder within the iTunes folder. The update that was pushed out was for iBooks to work with iOS 7 not iPhone 5. iOS 7 was released today.

  • Why the 'LIKE' operator takes so much time to run?

    I have a table T with 3 columns and 3 indexes:
    CREATE TABLE T
    id VARCHAR2(38) NOT NULL,
    fid VARCHAR2(38) NOT NULL,
    val NVARCHAR2(2000) NOT NULL
    ALTER TABLE T ADD (CONSTRAINT pk_t PRIMARY KEY (id,fid));
    CREATE INDEX t_fid ON T(fid);
    CREATE INDEX t_val ON T(val);
    Then I have the following two queries which differ in only one place - the 1st one uses the '=' operator whereas the 2nd uses 'LIKE'. Both queries have the identical execution plan and return one identical row. However, the 1st query takes almost 0 second to execute, and the 2nd one takes more than 12 seconds, on a pretty beefy machine. I had played with the target text, like placing '%' here and/or there, and observed the similar timing every time.
    So I am wondering what I should change to make the 'LIKE' operator run as fast as the '=' operator. I know CONTEXT/CATALOG index is a viable approach, but I am just trying to find out if there is a simpler alternative, such as a better use of the index t_val.
    1) Query with '=' operator
    SELECT id
    FROM T
    WHERE fid = '{999AE6E4-1ED9-459B-9BB0-45C913668C8C}'
    AND val = '3504038055275883124';
    2) Query with 'LIKE' operator
    SELECT id
    FROM T
    WHERE fid = '{999AE6E4-1ED9-459B-9BB0-45C913668C8C}'
    AND val LIKE '3504038055275883124';
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=99)
    1 0 TABLE ACCESS (BY INDEX ROWID) OF 'T' (Cost=1 Card=1 Bytes=99)
    2 1 INDEX (RANGE SCAN) OF 'T_VAL' (NON-UNIQUE) (Cost=4 Card=12)

    I will for sure try to change the order of the PK and see whether there will be any impact to the performance.
    In our application, val is much closer to a unique value than fid. In the example query, the execution plan showed that the index on val was indeed used in the execution of the query. That's why the 1st query took almost no time to return (our table T has more than 6 million rows).
    I was hoping the 'LIKE' operator would utilize the t_val index effectively and provide similar performance to the '=' operator. But apparently that's not the case, or needs some tricks.

  • Cross-post: Using the "as" operator vs casting

    I'm cross posting this because it is technically an
    Actionscript question, but it has real Flex consequences.
    I've recently been reading the docs regarding data types in
    AS3 and am still not clear on a few things. If anyone has blogged
    on this, please point me there.
    One problem is that "casting" syntax is the same as top-level
    function syntax. Compare String(objString) to XML(event.result).
    The latter is a top-level function, but the former is a "cast". Or
    is it?
    An option to the String cast is objString.toString(). What is
    the difference? I am not so much interested in the underlying
    details of the language, as in understanding when to use which.
    The same question exists for the top-level function
    XML(event.result), which can be done with the "as" operator:
    event.result as XML. When to use which? Are there performance
    issues? The "as operator" documentation is unsatisfying.
    Any discussion of this will be appreciated.
    Tracy

    Maltus now I'm totally confused.
    The Flex manual in the TOP LEVEL section (Guess TOP LEVEL
    means that they don't belong to any package) clearly states this
    functions:
    Function Description
    Array Creates a new array.
    Boolean Converts the expression parameter to a Boolean value
    and returns the value.
    decodeURI Decodes an encoded URI into a string.
    decodeURIComponent Decodes an encoded URI component into a
    string.
    encodeURI Encodes a string into a valid URI (Uniform
    Resource Identifier).
    encodeURIComponent Encodes a string into a valid URI
    component.
    escape Converts the parameter to a string and encodes it in
    a URL-encoded format, where most nonalphanumeric characters are
    replaced with % hexadecimal sequences.
    int Converts a given numeric value to an integer value.
    isFinite Returns true if the value is a finite number, or
    false if the value is Infinity or -Infinity.
    isNaN Returns true if the value is NaN(not a number).
    isXMLName Determines whether the specified string is a valid
    name for an XML element or attribute.
    Number Converts a given value to a Number value.
    Object Every value in ActionScript 3.0 is an object, which
    means that calling Object() on a value returns that value.
    parseFloat Converts a string to a floating-point number.
    parseInt Converts a string to an integer.
    String Returns a string representation of the specified
    parameter.
    trace Displays expressions, or writes to log files, while
    debugging.
    uint Converts a given numeric value to an unsigned integer
    value.
    unescape Evaluates the parameter str as a string, decodes
    the string from URL-encoded format (converting all hexadecimal
    sequences to ASCII characters), and returns the string.
    XML Converts an object to an XML object.
    XMLList Converts an object to an XMLList object.
    So how do I do a XML type casting without using the XML
    function for example? or is it the same?

  • Using the "as" operator vs casting?

    I've recently been reading the docs regarding data types in
    AS3 and am still not clear on a few things. If anyone has blogged
    on this, please point me there.
    One problem is that "casting" syntax is the same as top-level
    function syntax. Compare String(objString) to XML(event.result).
    The latter is a top-level function, but the former is a "cast". Or
    is it?
    An option to the String cast is objString.toString(). What is
    the difference? I am not so much interested in the underlying
    details of the language, as in understanding when to use which.
    The same question exists for the top-level function
    XML(event.result), which can be done with the "as" operator:
    event.result as XML. When to use which? Are there performance
    issues? The "as operator" documentation is unsatisfying.
    Any discussion of this will be appreciated.
    Tracy

    ActionScript 3.0 has the
    as operator because it circumvents a deficiency with the
    cast operation () in ActionScript. Consider this:
    var a:Object = new Array(1,2,3,4);
    var b:Array = Array(a);
    What is b? It is an Array of 1 element: [ [1,2,3,4] ];
    The
    as operator takes care of this:
    var b:Array = a as Array;
    The actual difference in the operators is that if the
    variable being cast is not of the proper type, the
    as operator returns null while the () operator throws an
    exception:
    var j:Number = Number(a); // exception!
    var k:Number = a as Number; // NaN in this case, but null
    normally
    The feeling here at Adobe is to use the
    as operator since it is not ambiguous and just check for
    null. If you prefer to catch exceptions and know when X(y) is a
    cast vs a conversion, then use that. More of a preference but at
    times only
    as will do what you need.

  • What exacly does filtering by the "like" operator do?

    I'm using Apex 3.1 and in my interactive report I'm using the "Filter" option from the action menu. What exactly does the "like" operator do?
    For example if I have a string "male" does the like operator search for all words
    %male
    male% or
    %male%
    Thanks!

    If you test it out you will see that the IRR simply wraps whatever you enter into standard SQL syntax. So, selecting 'Job' 'like' and entering 'MAN' returns no rows against the EMP Table. Changing that to 'Job' 'like' 'MAN%' returns 'MANAGER's and 'Job' 'like' '%MAN' returns 'SALESMAN's (excuse the improper grammar). Your users need to put the % where they want the wildcard. We also mention it in the Help available off the Actions Menu - "The expression is case sensitive and you can use % as a wild card (e.g. STATE_NAME like A%).
    Hope that helps -
    -- Sharon

  • Could not initialize photoshop because of a problem using the adobe color engine (Win 7)

    Was running the lastest version of Photoshop CS5 and added a second quad graphics card and 4 more monitors.  Now PS will not start and I get the error message "could not initialize photoshop because of a problem using the adobe color engine."
    Computer has 2 NIVDIA Quadro4 NVS420 graphics boards with 8 Samsung SyncMaster 1920x1080 monitors.  If I disable 4 of the monitors CS5 starts normally.  I do not have to remove the added graphics card.  When I extend the desktop again to all 8 monitors I get the error above.
    How do I trouble-shoot the problem?  Is it Photoshop, NIVDIA or Windows 7?

    Well, not exactly a full solution yet (at least for my setup), but I am certain now that this issue is (mostly) caused by nVidia's drivers. You may be able to fix your setup by simply installing the latest drivers for your NVS420 cards (266.45 for Win 7/64 rel. 01/12/2011).
    Since you are using two identical cards, this could do the trick.
    Caveats - Make sure you:
    1. Select Custom Install, the Express Install will most likely not work properly.
    2. Unselect the Audio Driver (if available), the nVidia HD(MI) Audio driver could
        screw up your speech recognition (if you use it) or other audio software - it did for me.
    3. Select Clean Install. If you don't, files like C:\Windows\System32\drivers\nvlddmkm.sys
        and several other driver related files will not be overwritten, causing all sorts of neat effects.
    4. After the Install is complete, reboot your system whether the Installer prompts you or not.
    After testing various configurations, disabling two - six of my eight monitors I am at this point:
    I am now using nVidia's lastest and greatest piece of crap (read driver), version 266.58, released just two days ago. After an initial snag with maximized windows extending to the bottom of the main monitor (underneath the taskbar), a re-install & reboot solved that issue.
    All three driver versions tested (260.89, 260.99, 266.58) now allow me to start PhotoShop without any problems; providing I first disable the two monitors fed by my onboard graphics (nVidia 780a based), leaving me with six monitors connected to three GTS-450 cards.  I can even re-enable the two other monitors once the program is open, and it continues to work fine. However, I must disconnect them again for the next start of PhotoShop.
    On an interesting side note:
    After disabling six monitors (leaving only two on a GTS-450), I was also able to open and run SoundBooth CS5, which previously would not open, citing the audio driver as the problem. After sucessfully starting SoundBooth I could re-enable all six other monitors (incl. onboards),
    and that program now opens and works fine with all 8 monitors connected. [ODD !!!]
    Other than Adobe Software, I've had only one other issue with my setup:
    When playing online poker at PokerStars, occasionally and quite randomly one of multiple tables would freeze up. I'll try disabling the two onboard monitors for that program as well to see whether the random freezes stop.
    Overall, while I think that Adobe produces fine software and nVidia has been in need of an overhaul for quite some time now, I also think that Adobe and nVidia software engineers need to work more closely together to ensure that problems like this don't arise in the first place after a product has been released to the public. IMHO, this is avoidable!
    PS:
    Here's a link to a great tool for multiple monitors, Display Fusion by Binary Fortress.
    I use the free version, it allows you to do cool things like have individual wallpapers for all
    your monitors, or stretch a single image across all monitors. With the Pro Version ($25),
    you can also add individually customizable taskbars to each monitor, and a lot more.
    http://www.displayfusion.com/

  • Could not complete the command because of a problem using the Adobe Color Engine

    Hi all
    This bizarrely started this morning - completely out of the blue - and I've no idea why.
    Setup: Mac 10.8.2 / Creative Suite Premium PhotoShop CS5 extended (patched to 12.04)
    Am working on images exported from LightRoom 4 (16bit A3 Pro Photo RGB PSDs) in PhotoShop CS5.
    As part of my image grading process I have a PhotoShop Action that does the following: copy layer to new document (document respects all of copied layer settings) > Image > Adjustments > HDR toning > apply a certain HDR preset > copy to resultant image back to original doc > set opacity as 40%.
    Totally out of the blue, after having this action for about 2 months, this morning I start getting a warning dialog of "Could not complete the command because of a problem using the Adobe Color Engine" and the action fails. The failure seems to take place at the 'make document' part of the action and seems to somehow be related to the contents of the clipboard.
    I've tried trashing and re-creating the action. It works first time out fine and then - on the next image - errors again.
    At present I can only safely carry out the work 'manually' by completing all the actions myself.
    I can think of no settings that have changed and the OS hasn't been updated in a while.
    I have found one other thread on a similar problem in PhotoShop Elements, but no definitive solution.
    Any help appreciated as I have a shedload of stuff to process.
    Best wishes
    TP

    OK: trash of prefs didn't work. Tried thrice. Re-created orig action. same problem.
    BUT!
    Your 'Image > Duplicate' suggestion does seem to work. If I use that in a new action as the method for creating the HDR version doc (instead of 'Select > Copy > New > Paste), it seems to work.
    Will try that out this afternoon, but for now: WIN!
    Many thanks for the suggestion!
    TP

Maybe you are looking for

  • Moved my mac over to a new HD and my Windows Partition no longer boots.

    Hello people smarter than me.  I seek knowledge and skills I do not posses.  I replaced my SSD with a bigger one going from 240gb to 960gb.  The old one had two bootcamp OS partitions (Mac, Windows) and four partitions (EFI System Partition, Recovery

  • Hook up 2 w2007 to laptop

    I have a new laptop and want to hook up 2 HP w2007 monitors.  My laptop has 1 VGA connector.

  • Tax  Account determination

    Hi everyone, I would like to know how can i assign a general ledger account to a vat tax indicator. I know how to do it assigning it to an operation but  i would like to assign the account directly to the tax indicator cause i want to assign differen

  • Using lingo for returing cue points of a sound

    Hello all for returning a list of cue point of a sound ,it is written in the book that we should use the following lingo put the cuePointNames of member "mySound" realy I have a sound member which have cue points ,but I don't know where to use this l

  • Multiple use of Dehydration Store Instance?

    This may seem like a stupid question, but we just brought up our second App Server instance pointing to the same Dehydration store instance. It appears to be working, but we have only installed one process for the second BPEL instance. Can two instan