LIKE, LIKEC and Index usage

I've table that contains about 20 million rows, and I've created index for varchar2(100) column. It works well if I do
SELECT * FROM MY_TABLE WHERE MY_COL LIKE 'FOO%';
But if I change query to use LIKEC (to make unicode escaped strings work):
SELECT * FROM MY_TABLE WHERE MY_COL LIKEC 'FOO%';
I always get full table scan in explain plan.
I tried to use NVARCHAR, or index created by TO_NCHAR but I always end up hitting full table scan.
Should I create index some special way or do something else before I get index working?

Just a gut feeling : is the database using character semantics or byte semantics?
My gut feeling, after looking up the documentation, is it should be character semantics.
BTW: Not posting version info decreases the chance you get an adequate reply.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Outer Join and Index Usage

    I am simply trying to run the following query:
    select /*+ index (serialnumber trans) */ distinct device,
    device_path||device hierarchy,
    sn.serialnumber
    from z_xfmr_levels z
    left join serialnumber sn
    on z.device = sn.transformergrid(+);
    I am using Oracle 9i
    z_xfmr_levels has 75,000 distinct rows
    serialnumber has 204,000 distinct rows
    The explain plan shows a hash join and a full table scan on both tables.
    How can I get the query to use the index on the transformergrid field of the serialnumber table?

    user10441616 wrote:
    I am simply trying to run the following query:
    select /*+ index (serialnumber trans) */ distinct device,
    device_path||device hierarchy,
    sn.serialnumber
    from z_xfmr_levels z
    left join serialnumber sn
    on z.device = sn.transformergrid(+);
    I am using Oracle 9i
    z_xfmr_levels has 75,000 distinct rows
    serialnumber has 204,000 distinct rows
    The explain plan shows a hash join and a full table scan on both tables.
    How can I get the query to use the index on the transformergrid field of the serialnumber table?What makes you think an index access is more appropriate than the the two full scans and a hash join?
    If you have some legitimate reason, please share ... if not, please read this http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:9422487749968

  • Like clause and index access

    Hi All,
    I've gone through below link to how to use index while using LIKE operator in SQL.
    [http://laurentschneider.com/wordpress/2009/07/how-to-tune-where-name-likebc.html]
    I've tried the same approach in Employees Table,but index not being used.
    --there is a normal Index on Job_id named by EMP_JOB_IX.
    SQL10.2> select /*+ INDEX(employees EMP_JOB_IX)*/ e.job_id,e.first_name
    from employees e where e.job_id like '%ABC%';
    ---Explain plan
    SELECT STATEMENT, GOAL = ALL_ROWS               3     5     80
    TABLE ACCESS FULL     HR     EMPLOYEES     3     5     80
    Pls let me know why it is full table scan.(using version 10.2)
    Thanks,

    SQL>EXEC dbms_stats.gather_table_stats(user,'EMPLOYEES',cascade=>true);
    SQL>select /*+ INDEX(employees ,EMP_JOB_IX)*/ e.job_id,e.first_name
    from employees e where e.job_id like '%ABC%' ;
    SELECT STATEMENT, GOAL = ALL_ROWS               3     5     80
    TABLE ACCESS FULL     HR     EMPLOYEES     3     5     80
    Still showing the Table full scan.

  • Oracle evolution suggestion : NULL and Index

    Hello,
    As you know in most of case NULL values are not indexed and then not searchable using index.
    Then when you do where MyField is null, you have the risk of doing a full table scan
    However most of people don't know that, and then doesn't care of this possible issue and of possible solution (bitmap or including a not null column)
    SQL Server, MySQL and probably some others DB don't have the same behavior as they indexes NULL
    I know this caveat can be used to have partial indexing by nulling non interesting values and then can't be removed
    Then I would suggest to enhance the create index command to allow to index also null with something like that
    Create index MyIndex on MyTable(MyColumn including nulls )
    As you make this change, perhaps it would be geat to change the behavior documented bellow as it looks more as an old heritage too by adding keyword like "allow null duplicate" and "constraint on null duplicate"
    Ascending unique indexes allow multiple NULL values. However, in descending unique indexes, multiple NULL values are treated as duplicate values and therefore are not permitted.
    Laurent

    Hello,
    Thanks, for the links it cover mains solutions to index null values, there's also the usage of bitmap index.
    All of them are not very intuitive for an non expert.
    But the purpose of my message was mainly to higlight this complexity for a quite basic stuff, as I think that the default solution should be to index nulls and eventually allow to do not index them.
    As I said this is the behavior on sql server and mysql. That why i suggest to enhance index behavior to allow to index nulls easily and not by using stange tips like indexing a blank space or a not null column.
    This solutions are from my viewpoint workaround, helpfull workaround but still workaround, Oracle database team have the power to change this root cause without breaking ascending compatibility, here is the sense of my message, just hopping they can hear me...
    Laurent

  • Is there any function like malloc and free in labview?

    Im writing a vi that will handle my memory request.
    Im doing a very high speed video record sessions , and the frames cant be saves on hardisk in realtime), so im saving the frames on memory, and i want to use memory as
    much as i can(~2GB) and to save the maximum frames that i can save (and it depends on bit depth, height, width, total memory).
    VI Operations={
    Allocate Memory (frame width, frame height,TotalMemorySize) ,
    Add Frame(index) ,
    Get Frame (index),
    Free Memory
    In each record session, there will be a different FrameWidth and Height, so the maximum frame that i can save in memory may be different and equal to
    IndexMax=TotalMemorySize/(FrameWidth*FrameHeight)
    Im doing this by allocating a 3D array [FrameIndex , row , column]
    The fact that the width and height change in different sessions indicate  that i need an ability to free the previous allocated 3D array memory and allocate a new one.
    (lets say that i have 2GB total memory..)

    This request really takes the system and the programmer to the limits....
    First of all:
    LabVIEW does not have any functions like malloc and free. LV wants to prevent the user to have to think about stuff like this. On the other hand, the memory management in LV is therefore hard to do or even impossible, at least to such an extend as you request.
    Some thoughts about your application:
    1. If you want to have about 2GB of framedata in RAM during runtime, you will need the large memory awareness active. Otherwise, a 32 bit OS will give you "out of memory" messages. Refer to the LV help "VI memory usage".
    2. Storing the data in an array could be a difficult task. Arrays have to be in memory without any gap. Therefore, you'd encounter "out of memory" messages even if your RAM totals enough free memory (theoretical).
    3. The idea of linked-lists does not compy in LV since you cannot store pointers to structs (since those are abstracted from the user).
    4. Maybe you should take a look into vision. 
    hope this helps,
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • List of Hints and there usage?????

    Can anybody give me the link/doc having the sql hints in oracle 9i or 10g
    and having a good description on there usage.
    Regards
    Gagan

    Agree with you John - especially on the DRIVING_SITE hint.
    But I still feel the message itself needs to be strong. Nothing as frustrating as having developers releasing code that for example forces a PQ degree of 20 simply because that was the first number that sprung to mind. Or forcing an global index (indexes is good) as they did not like the CBO doing a FTS on the partition (FTS is bad). Etc.
    Sometimes I even get a mix of nonsense hints like forcing an index range scan and trying to force a PQ too - when asked the answer is along the lines of "oh, it is faster in parallel". Tuning by observation. "Oh, look, it is faster the 2nd time around! PQ works great!!" And not even considering that there are now less PIOs due to the db cache.
    It becomes real messy trying to fix. What frustrates me is that such developers usually have Oracle in low regard and see hints as a necessity to force it to behave correctly. And they have the tendency to complain loudly very quickly when it does not work how they expect it to work and blame Oracle as a poor product. If they spend that energy and effort instead of learning Oracle concepts and fundamentals... sigh

  • What is the difference between Topic Keywords and Index File Keywords?

    What is the difference between Topic Keywords and Index File Keywords? Any advantages to using one over the other? Do they appear differently in the generated index?
    RH9.0.2.271
    I'm using Webhelp

    Hi there
    When you create a RoboHelp project you end up with many different ancillary files that are used to store different bits of information. Many of these files bear the name you assigned to the project at the time you created it. The index file has the project name and it ends with a .HHK file extension. (HHK meaning HTML Help Keywords)
    Generally, unless you change RoboHelp's settings, you add keywords to this file and associate topics to the keywords via the Index pod. At the time you compile a CHM or generate other types of output, the file is consulted and the index is built.
    As I said earlier, the default is to add keywords to the Index file until you configure RoboHelp to add the keywords to the topics themselves. Once you change this, any keyword added will become a META tag in the topic code. If your keyword is BOFFO, the META tag would look like this:
    <meta name="MS-HKWD" content="BOFFO" />
    When the help is compiled or generated, the Index (.HHK) file is consulted as normal, but any topics containing keywords added in this manner are also added to the Index you end up with. From the appearance perspective, the end user woudn't know the difference or be able to tell. Heck, if all you ever did was interact with the Index pod, you, as an author wouldn't know either. Well, other than the fact that the icons appear differently.
    Operationally, keywords added to the topics themselves may hold an advantage in that if you were to import these topics into other projects, the Index keywords would already be present.
    Hopefully this helps... Rick

  • Difference between a partition and index

    In BW how does an index differ from a partition? Thanks

    Hi,
    Partitioning works on the Binary Search functionality.The data is divided into parts and stored logically.Depending on the variable input the data is fetched intelligently through Data Mining concept.
    For eg: if you have 120 records of Customer say 10 records per month and you have done a partition on 0CALMONTH.
    So now the data will be stored in 12 sets of 10 each for a year data.Now depending upon your input say you put June month along with other selection then it will hit only the set for June month.So instead of searching for all over 120 records it will search only in that 1 set of 10 records.This improves query performance.
    However, the restriction is that partitioning can be done only on time variable.
    Whereas, Indexing works like the Primary Index or Key field of an R/3 table.
    More the Index better the search and query performance.But again the flip side is it will complicate the design to provide Index on many fields and data loading time would be increased.Any changes and you would require to drop the index then reload and then again rebuild the Index.The number of Indexes to be used to improve query performance is a compromise between designs.
    Hope this helps.

  • Get CPU and memory usage

    Hi!
    I would like to know if there is any way of getting system CPU and memory usage using Java code.

    I want to get the system CPU and memory usage using the performance monitor dll, the perfctrs.dll, but access this data using Java language.Then you should create wrapper dll between your java code and perfctrs.dll and convert data from format of dll to format of your java code.
    So, that is next question - how to create wrapper dll, how to deal with or how perfctrs.dll works?

  • Scratch disks and RAM usage

    i would like to understand the relationship between scratch disks and RAM usage in Photoshop.
    While i was working on a fairly big psb file (2gb), photoshop kept prompting that I was out of memory, but in fact the utilization was only 75% (i had 16gbs total, photoshop was only using 7gb, and i allowed PS to use up to 14gb in total). when it says out of memory, it was actually my scratch disk at fault ( i only set 1 scratch disk, which was my 120gb SSD running out of space).
    any idea how I can optimize PS to use up all my RAM first before even touching my scratch disk? (short of using a RAMdisk, please).
    thanks!

    I am curious about this also. I just reinstalled W-7--have 11 G of physical memory--a ton of hard drive empty space also, and I have been wondering why PS_CC is so slow--since basically I have only put my Security and Browser in addition to Adobe back on the Dell XPS computer..... At least now it does show the downloading percentage (like .psd file) , but that must be what is happening.  I do think that some of these "frozen" screens I have been experiencing, was because the program was using scratch disk, instead of the Ram... I came up from CS-5, and can't describe it in detail, but just realize how slow PS-CC is in most everything.  Going back and see if reallocating will help...

  • UNUSED EXISTING INDEXES / Index usage

    We are using CRM 2007, Netweaver 7.0 with DB2 UDB v9.1 fixpack4 on AIX.
    Is there a way to find out  UNUSED EXISTING INDEXES for tables ? We have close 12 indexes on the crmd_order_index table and want to find out if some of them can safely deleted. Is there any way to monitor index usage in SAP ? Is there any toold to aid this ?
    Pls advise.
    thank you
    regards
    Laxmi

    Laxmi,
    I am not aware of any such tools with DB2 9.1.  However, "last_used" columns are being added to various catalog tables in DB2 9.7.  Below is an excerpt from a slide presented in the  TLU2008A "DB2 LUW V9.7 Cobra u2013 Storage is Charmed" session.
    The last reference time of an object will now be maintained in the LASTUSED column of
    the corresponding catalog table for the object
    u2013 SYSCAT.INDEXES.LASTUSED (prior to V9.7 db2pd u2013tcbstats indexes)
    u2013 SYSCAT.TABLES.LASTUSED
    u2013 SYSCAT.DATAPARTITIONS.LASTUSED
    u2013 SYSCAT.PACKAGE.LASTUSED
    The LASTUSED column is of type DATE (default value is 1/1/0001)
    Use Cases:
    u2013 Detach table partitions that are no longer actively used (esp. when not partitioned by time)
    u2013 Determine inactive or infrequently used indexes
    u2013 Easily identify tables which are no longer in use
    u2013 Get rid of unused packages
    The presenter said the code will begin populating these columns in an upcoming fixpack.
    Regards,
    Rick

  • How can we find the most usage and lowest usage of table in Sql Server by T-SQL

    how can we find the most usage and lowest usage of table in Sql Server by T-SQL
    The table has time stamp column
    StartedOn datetime
    EndedOn datetime

    The Below query has been used , but the textdata column doesnot include the name of the table ServiceLog.
    SELECT
    FROM
    databasename,
    duration
    fn_trace_gettable('F:\Program
    Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\log_148.trc',
    default)
    WHERE
    DATABASENAME='ZTCFUTURE'
    AND TEXTDATA
    IS
    NOT
    NULL
    --AND TEXTDATA LIKE 'SERVICE%'
    order
    by cpu
    desc; 

  • 'IS NOT NULL' & Index Usage

    Hi,
    there are many queries my one of my packages, which has the SQL as follows:
    Update table XYZ
    Set Column A = NULL
    Where Colum B IS NOT NULL;
    Column B has NUMBER datatype.
    Due to 'IS NOT NULL' the index (existing for Column B' is not being used in the above query, leading to Full table scan. Is there any ways of forcing teh index to be picked/used by the query?
    Thanks,
    Rosalin

    thansk again for response. Checked the % of the data
    fetched by this query and it ranges from 20% to 50
    %(varies due to teh fact the table data content could
    have different set of data depending on the days
    transactions done). So for sure index usage would
    help.
    Additionally this sql(used in multiple places) come
    up in the v$longsops output.
    so definitely needs tuning.
    Any suggestions?That's not really true though if you understand the mechanisms employed for a full table scan vs an index scan / table lookup (by rowid since the table must also be visited).
    Here's something good for you to read
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4433887271030
    A full tablescan reads the table using large sequential reads -- many blocks at a time.
    Sequential reads are the fastest type of IO you can do on a disk in general.
    An index read will do single block, random IO's. These are generally the slowest you can
    do.
    I would suggest to you that if you have statistics on the table/indexes that are representative of the data, the Optimizer will be smarter than you (most cases, not all).
    Message was edited by:
    Tubby

  • Where to see CPU and RAM usage in IPAD 1

    Hi:-)
    While i have Apps running , I would like to be able to see CPU and RAM in use..and ideas how/where?
    Thanks

    There are several apps in the app store that can show you cpu and ram usage of your device, e.g. "system info"

  • DB02 view is empty on Table and Index analyses  DB2 9.7 after system copy

    Dear All,
                 I did the Quality refresh by System copy export/import method. ECC6 on HP-UX DB29.7.
    After Import Runstats status n Db02 for Table and Index analysis was empty and all value showing '-1'. Eventhough
    a) all standard backgrnd job scheduled in sm36
    b) Automatic runstats are enabled in db2 parameters
    c) Reorgchk all scheduled periodically from db13 and already ran twice.
    4) 'reorgchk update statistics on table all' was also ran on db2 level.
    but Run stats staus in db02 was not getting updated. Its empty.
    Please suggest.
    Regards
    Vinay

    Hi Deepak,
    Yes, that is possible (but only offline backup). But for the new features like reclaimable tablespace (to lower the high watermark)
    it's better to export/import with systemcopy.
    Also with systemcopy you can use index compression.
    After backup and restore you can have also reclaimable tablespace, but you have to create new tablespaces
    and then work with db6conv and online table move to move one tablespace online to the new one.
    Best regards,
    Joachim

Maybe you are looking for

  • When I plug ipod into itunes recieve message: scan and fix

    Ok, whenever I plug my ipod nano 5th generation into my hp laptop with vista I recieve a message saying 'there might be a problem with some files on this disk/device. This can happen if you remove the disk/device before all files have been written to

  • Info record Po text not printing in Po

    Hi all,          Info record po text not printing in po print out. Info record po text showing in po at item level but it was not printing in po. In info record No matl text checked. In material master no text maintained. please help on this         

  • PDF Forms filled out don't display on Ipad2

    I use Dropbox to organize many of my files.  Some of those files are PDF forms that have been filled out.  They display correctly on my PC and my android phone.  However, they show up as blank forms on my Ipad2.  Why?  I have tried GoodReader, Dropbo

  • Simple introduction/tutorial on how to make Cocoa-Applescript Applets?

    I'm looking for a simple tutorial on how to make Cocoa-Applescript Applets.  I'm pretty new to Applescript, but fairly good at it, and I was wondering how Cocoa-Applescript Applets worked.  I was curious as I've been wondering if it was possible to s

  • Auto-recation method not changed/saved

    Hi, Auto-recation method not changed/saved In R3 4.6C DEV system, RZ20 MTE = (Filesystem percentageUsed) click on properity and click on Method TAB in Auto-recation method already setup "Z_NSM_CCMS_OnAlert_Email_V2" I want to change or replace with C