5 Replies Latest reply on Sep 20, 2013 6:48 PM by orausern

    About index memory parameter for Oracle text indexes


      Hi Experts,


      I am on Oracle on Linux and have implemented Oracle Text. I am not an expert in this subject and need help about one issue. I created Oracle Text indexes with default setting. However in an oracle white paper I read that the default setting may not be right. Here is the excerpt from the white paper by Roger Ford:


      "(Part of this white paper below....)

      Index Memory                                    As mentioned above, cached $I entries are flushed to disk each time the indexing memory is exhausted. The default index memory at installation is a mere 12MB, which is very low. Users can specify up to 50MB at index creation time, but this is still pretty low.                                   

      This would be done by a CREATE INDEX statement something like:

       CREATE INDEX myindex ON mytable(mycol) INDEXTYPE IS ctxsys.context PARAMETERS ('index memory 50M');  

      Allow index memory settings above 50MB, the CTXSYS user must first increase the value of the MAX_INDEX_MEMORY parameter, like this:                                

       begin ctx_adm.set_parameter('max_index_memory', '500M'); end;  

      The setting for index memory should never be so high as to cause paging, as this will have a serious effect on indexing speed. On smaller dedicated systems, it is sometimes advantageous to temporarily decrease the amount of memory consumed by the Oracle SGA (for example by decreasing DB_CACHE_SIZE and/or SHARED_POOL_SIZE) during the index creation process. Once the index has been created, the SGA size can be increased again to improve query performance."

      (End here from the white paper excerpt)

      My question is:

      1) To apply this procedure (ctx_adm.set_parameter) required me to login as CTXSYS user. Is that right? or can it be avoided and be done from the application schema? This user CTXSYS is locked by default and I had to unlock it. Is that ok to do in production?

      2) What is the value that I should use for the max_index_memory should it be 500 mb - my SGA is 2 GB in Dev/ QA and 3GB in production. Also in the index creation what is the value I should set for index memory parameter  - I had left that at default but how should I change now? Should it be 50MB as shown in example above?

      3) The white paper also refer to rebuilding an index at some interval like once in a month:   ALTER INDEX DR$index_name$X REBUILD ONLINE;

      --Is this correct advice? i would like to ask the experts once before doing that.  We are on Oracle 11g and the white paper was written in 2003.


      Basically while I read the paper, I am still not very clear on several aspects and need help to understand this.




        • 1. Re: About index memory parameter for Oracle text indexes

          Hello Experts,


          Any help/pointers on the above?




          • 2. Re: About index memory parameter for Oracle text indexes
            Roger Ford-Oracle

            Perhaps it's time I updated that paper


            1.  To change max_index_memory you must be a DBA user OR ctxsys. As you say, the ctxsys account is locked by default. It's usually easiest to log in as a DBA and run something like

            exec ctxsys.ctx_adm.set_parameter('MAX_INDEX_MEMORY', '10G')


            2.  Index memory is allocated from PGA memory, not SGA memory. So the size of SGA is not relevant. If you use too high a setting your index build may fail with an error saying you have exceeded PGA_AGGREGATE_LIMIT.  Of course, you can increase that parameter if necessary. Also be aware that when indexing in parallel, each parallel process will allocated up to the index memory setting.


            What should it be set to?  It's really a "safety" setting to prevent users grabbing too much machine memory when creating indexes. If you don't have ad-hoc users, then just set it as high as you need. In 10.1 it was limited to just under 500M, in 10.2 you can set it to any value.


            The actual amount of memory used is not governed by this parameter, but by the MEMORY setting in the parameters clause of the CREATE INDEX statement. eg:

            create index fooindex on foo(bar) indextype is ctxsys.context parameters ('memory 1G')


            What's a good number to use for memory?  Somewhere in the region of 100M to 200M is usually good.


            3.  No - that's out of date.  To optimize your index use CTX_DDL.OPTIMIZE_INDEX.  You can do that in FULL mode daily or weekly, and REBUILD mode perhaps once a month.

            1 person found this helpful
            • 3. Re: About index memory parameter for Oracle text indexes

              Hi Roger,

              Thanks a lot. This is very helpful to me. One additional question if you can help is: Can you explain in simple term (as I am not an expert) , what is the importance of the index memory parameter?

              I was not able to get the concept clear, so asking this.


              Thanks again,


              • 4. Re: About index memory parameter for Oracle text indexes
                Roger Ford-Oracle

                Index entries are built in memory, then flushed to disk as the index memory is exhausted. Having a high index memory setting will mean the index entries can be longer and less fragmented, which provides for better query performance.  Conversely, a small index memory setting will mean the chunks flushed to disk are smaller, so queries (particularly on common words) will have to do significantly more I/O to fetch multiple index chunks for the word(s).

                • 5. Re: About index memory parameter for Oracle text indexes

                  Thanks a lot Roger!! I will set the memory parameter to 150MB to start with, and now I have better understanding about what it means.


                  Best regards,