Factor of clustering for the primary key Index

Hi all

I have cretead a new table with 1.7 million records with an index of primary key on ID (NUMBER)
Number of blocks used is arnd 57 K.

Factor value of clustering on the primary key index is 1.6 million.

Could you please suggest what can be the reason for such a clustering factor high for the new table.


Thank you
Ash N.

Google is your friend:
http://www.dbasupport.com/forums/archive/index.php/t-38893.html
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1032431852141
http://hemantoracledba.blogspot.com.es/2008/01/impact-of-clustering-factor.html

Tags: Database

Similar Questions

  • creating a unique index of instaed of using the primary key index

    Hello

    I heard in a debate sometimes it is better to create a unique index on a column and use it instead of using the primary key index in oracle. I did not understand what that the reason propely.

    Can someone please help me in this topic if it is valid.

    Thanks in advance

    On the surface, which does not seem reasonable... Volume of the DML is irrelevent to determine which column is the primary key for a table.

    My wild speculation a bit at a reasonable time could someone do...

    If you use synthetic primary keys (i.e. the keys generated by sequence) and that your tables are subject to large volumes of inserts such as there is a danger that the block "to the right" will be the source of contention block and worry not about analysis of beach on the column, you can create a reverse on this column (unique or non-unique) key index before creating the primary key constraint and to indicate Oracle to use this existing index to respect the primary key constraint.

    Obviously, however, this involves a lot of assumptions to arrive at a reasonable point. There may well be another set of assumptions that could also lead to a valid argument. Or it could be a myth that someone has heard and just repeats.

    Justin

  • Performance problem on the SQL query that does not use the primary key index

    Hello!

    I have some performance issues on a single SQL query (Oracle 10 g).
    I could solve the problem by using the INDEX indicator, but I would like to know WHY this is happening.

    * Tables *.
    create table jobs)
    ID number (5) not null,
    name varchar2 (100),
    primary key constraint Job_PK (id)
    )
    /
    -Record count: 298

    create table Comp)
    integer ID not null,
    name varchar2 (100),
    primary key constraint Comp_PK (id)
    )
    /
    -Record count: 193

    -Relation m: n
    create table JobComp)
    integer ID not null,
    id_job integer not null,
    id_comp integer not null,
    primary key constraint JobComp_PK (id),
    unique key constraint JobComp_UK (id_job, id_comp),
    Constraint JobComp_FK_Job foreign key (id_job) refers to Job (id),
    Constraint JobComp_FK_Comp foreign key (id_comp) makes reference Comp (id)
    )
    /
    create index JobComp_IX_Comp on JobComp (Cod_Comp)
    /
    create index JobComp_IX_Job on JobComp (Cod_Job)
    /
    -Record count: 6431

    * Ask *.

    When I run this query, the execution plan shows the index using (JobComp_PK and JobComp_IX_Comp).
    No problem.

    Select JobComp.*
    of JobComp
    Join jobs
    on Job.id = JobComp.id_job
    where JobComp.id_comp = 134
    /
    -runs in 0.20 sec

    But when I add the field 'name' of the work table the plan uses full access table to the table of work

    Select JobComp.*, Job.name
    of JobComp
    Join jobs
    on Job.id = JobComp.id_job
    where JobComp.id_comp = 134
    /
    -runs in the 2.70 dry

    With the help of the index

    Select / * + INDEX (Job Job_PK) * /.
    JobComp.*, Job.name
    of JobComp
    Join jobs
    on Job.id = JobComp.id_job
    where JobComp.id_comp = 134
    /
    -runs in 0.20 sec

    * Doubt *.

    This behavior is correct?

    PS. : I tried to recalculate the statistics, but nothing changes:

    analyze the job calculation table statistics.
    /
    change the statistical calculation of index Job_PK reconstruction;
    /
    Start
    dbms_utility.analyze_schema (sys_context ('userenv', 'current_schema'), 'CALCULATE');
    end;
    /

    [of]
    Gustavo Ehrhardt

    Gus.EHR wrote:
    Hello.
    I'm sorry for the plan unformatted.
    The execution time of the querys "without field name' and 'with the field name with suspicion" are equal.
    He has no problem caching, because I get the plans of the sequence different from the querys and repeated the performance. The result is always the same.

    I don't think that there is no problem with oracle crossing LOOP IMBRIQUEE to the HASH JOIN when you include the field name and this should be the expected behavior. But it seems that your WORKING table has a degree of parallelism set against what is causing the query to run in parallel (as JOB table is now available with full table scan, instead of indexed access earlier). It could be that the parallel execution is contributor to extra Runtime.
    (a) do you know why the degree of parallelism on the WORK table has been defined? Do you need it?

    You can see if the following query provides a better response time?

    select /*+ NOPARALLEL(JOB) */ JobComp.*, Job.Name
      from JobComp
      join Job
        on Job.id = JobComp.id_job
     where JobComp.id_comp = 134
    
  • old age and the primary key index

    That question lingers on me for a long time. When I have a table(non-partitioned) with A column as a primary key, it makes no difference (in data retreival) if I create an index on column A. The oracle that I use is 10.2.0.3. My conclusion was pk already stores records in a sorted order and an index is not necessary.

    I also have a question on the index in the global temporary tables. A global temporary table was created initially with his index finger. Then, it is used with each session. As the data in a global temporary table are related to the session, oracle create index separated for each session?

    Hello

    When you create an on a column in a table's primary key, a unique index is created automatically, you need not create separate.

    Oracle Concepts:

    You can create indexes for temporary tables using the CREATE INDEX statement. Indexes created in the temporary tables are also temporary, and the data in the index have the same scope of session or transaction data in the temporary table.

    You can create views that access the temporary and permanent tables. You can also create triggers on temporary tables.

    For more information, see [temporary Tables | http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref769]

    Kind regards

    Published by: Walter Fernández on February 7, 2009 22:09 - Add URL...

  • DB sequence for the primary key

    Hello

    I have Table of key primary we use DB sequence in the database itself, for example if start a line (using sql client) DB without primary key sequence will do it for me, because of this trigger.

    (1) my doubt is if I generate A EO off this table I need to explicitly set db sequence for this attribute as this or no need to do this sequence bz DB does good for me!

    (new oracle.jbo.server.SequenceImpl("SEQ_NAME",adf.object.getDBTransaction())).getSequenceNumber()
    
    
    
    

    No, you use a db trigger all what you need to do is to define the type of the attribute DBSeqence. Then the framework will assign a negative value for the PK, which can and will be used as K until you commit the transaction. During this time the bed frame now generated correct sequence of relaxation and rights holders to PK all negative values of the line (and it's child row).

    Don't forget to check DBSequence attributes must have "Refresh on insert" together that it triggers the correct PK is read from the database after insertion.

    Do not use ' (new oracle.jbo.server.SequenceImpl ("SEQ_NAME", adf.object.getDBTransaction ()) .getSequenceNumber () ' attribute is the PK you use triggers to generate the sequence.

    Timo

  • reverse the primary key index

    Hello

    When we create a primary key, it automatically creates a unique index on it. He is sort can we give a clause to create a single inverted index on this subject?

    We can of course more late the state change an index to Conversely, but how to do it at creation time?

    Kind regards!
    create table test_123(c1 number primary key using index  reverse)
    
  • Problem with the primary key and indexes

    Hi all

    I'm looking a mess on one of our main tables.
    One of the developers here added an index on 3 columns in the table, thinking that it would speed up (not noticing that it had not a PK).

    Subsequently another developer has noticed there do not have a primary on key. So they added a touch of primry on the single column.

    The problem is that now the index created on 3 columns is bein used as the primary key index. As when the primary key is created a new index was not created.

    Is there anyway to get rid of this index/change it correct?

    This table is related to many many other tables, so when we tried to remove the index we could not due to the primary key and foreign key violations with other tables.

    Thanks in advance

    Oracle, as you found, is quite capable to use a column enformce multi index a single column primary key, as long as the pk column is the leader in the index. This should not cause performance issues for a search of PK and if the three indexed columns are often selected only may benefit from these types of queries.

    The only way to change that now, would be to drop all CF, drop and add the PK constraint and then add all the FK constraints. A long time and potentially dangerous (if you miss to add back of the FKs) endeavour. Certainly not worth the risk in my opinion.

    John

  • How to change the type of source for a primary key on a form?

    Hello

    When creating a form, I put the source type for the primary key of an existing sequence.

    Now, I want to change the source of a trigger.

    Can anyone suggest how do?

    Thanks in advance,
    Annie

    Annie:

    Set the trigger and then delete the process of the page named «Get PK»

    CITY

  • How to fill out the table foreign key to the primary key form

    Hi all

    I'm stuck in this problem for 3 days, and I'm about to research and implement solutions on the internet.

    I have two tables

    create table prim (a number primary key, b varchar2 (100));

    create table CHILD (a number references (a) prim, varchar2 (100)) c;

    I created a page for PRIM table.

    = page name form on PRIM2

    I have manually two columns for the CHILD table to know

    P26_A_1 (for the primary key in the CHILD table)

    P26_C (for the column in the CHILD Table c)

    now when the user clicks on the button CREATE, a row must be inserted into the child table.

    I want to assign the P26_A to P26_A_1 during the validation process, so that a line must be inserted into the PRIM table as well as in the CHILD table.

    How to do this?

    I downloaded my application page in https://apex.oracle.com

    my workspace identifiers are inferior to

    name of the workspace = IMBERT

    username = demo

    password = demo

    kindly guide me.

    Thank you.

    Hello

    I created a new page (page 30) similar to your page and added the insertion of the child. It just check the page and code. It works now, when you insert the prim file is triggered a second trial which inserts the child record manually.

    On page 26 it was some sort of mistake, was easier to create a new as it was almost a standard form.

    Concerning

    Bottom

  • How to refer to the primary key column of newly inserted rows of tabular form

    Hello

    I use APEX 4.2.0.00.27 with Oracle DB 11.2.0.3.0.

    I work with a tabular presentation wizard-created for insert and update a table using the integrated SRM process (sequence 10).  I'm trying to use a process of anonymous block of PL/SQL (sequence 30) to make another manipulation of table after the records were inserted or updated.  The manual process is associated with my tabular form and I use the variables of name of column binding in my program block.

    My (rsn_test) table has 3 columns: test_id (number), test_nbr (number), test_id2 (number).  Test_id column is identified as the primary key and the type of the source already exists a sequence rsn_test_seq.  Column test_id2 gets its default value 0 to a hidden page element.

    I would use my manual process for updating the value of the test_id2 column.  If it's 0 then I want to put the value of the column test_id.  If it is any other value, then it must remain at this value.  My logic works very well for an existing line, but I'm running into a problem with the newly added lines.  The new lines get inserted, but the test_id2 column remains the default value 0.  I can tell the debugger that the SRM process is triggered first and inserts the line, then my manual dealing with fires.  The problem seems to be that the connection variable: TEST_ID for the primary key column remains NULL after insertion.  I don't know how to get the value of the column test_id of my newly created line to use in my PL/SQL block to my update.

    Process of PL/SQL:

    DECLARE
    BEGIN
       :P7_SHOW := NULL;
       :P7_SHOW := NVL(:TEST_ID2,555) || ' and ' || NVL(:TEST_ID,787) || ' and ' || NVL(:TEST_NBR,9999);
       IF :TEST_ID2 = 0 AND :TEST_ID IS NOT NULL THEN
          UPDATE rsn_test
             SET test_id2 = :TEST_ID
           WHERE test_id = :TEST_ID;
       ELSE
          :TEST_ID2 := :TEST_ID2;
       END IF;
    END;
    
    

    Excerpt from the debugger:

    0.01625 0.00010 Processes - point: ON_SUBMIT_BEFORE_COMPUTATION
    0.01635 0.00008 Branch point: Before Computation
    0.01643 0.00003 Process point: AFTER_SUBMIT
    0.01646 0.00022 Tabs: Perform Branching for Tab Requests
    0.01668 0.00008 Branch point: Before Validation
    0.01676 0.00024 Validations:
    0.01700 0.00135 Perform basic and predefined validations:
    0.01835 0.00020 Perform custom validations:
    0.01855 0.00049 ...Validation "TEST_NBR must be numeric" - Type: ITEM_IS_NUMERIC
    0.01904 0.00007 ......Skip for row 1 because row hasn't changed
    0.01911 0.00016 ......Skip for row 2 because row hasn't changed
    0.01927 0.00012 ...Validation "TEST_ID2 must be numeric" - Type: ITEM_IS_NUMERIC
    0.01939 0.00007 ......Skip for row 1 because row hasn't changed
    0.01945 0.00018 ......Skip for row 2 because row hasn't changed
    0.01964 0.00005 Branch point: Before Processing
    0.01968 0.00004 Processes - point: AFTER_SUBMIT
    0.01972 0.00588 ...Process "ApplyMRU" - Type: MULTI_ROW_UPDATE
    0.02560 0.00154 ...Execute Statement: declare function x return varchar2 is begin begin for c1 in ( select "RSN_TEST_SEQ".nextval pk from sys.dual ) loop return c1.pk; end loop; end; return null; end; begin wwv_flow.g_value := x; end;
    0.02714 0.00140 ......Row 3: insert into "APPPCSRSN"."RSN_TEST" ( "TEST_ID", "TEST_NBR", "TEST_ID2") values ( :b1, :b2, :b3)
    0.02854 0.00011 ...Process "ApplyMRD" - Type: MULTI_ROW_DELETE
    0.02865 0.00004 ......Skip because condition or authorization evaluates to FALSE
    0.02869 0.00015 ...Process "Process Submit" - Type: PLSQL
    0.02884 0.00007 ......Skip for row 1 because row hasn't changed
    0.02891 0.00012 ......Skip for row 2 because row hasn't changed
    0.02903 0.00012 ......Process row 3
    0.02915 0.00429 ...Execute Statement: begin DECLARE BEGIN :P7_SHOW := NULL; :P7_SHOW := NVL(:TEST_ID2,555) || ' and ' || NVL(:TEST_ID,787) || ' and ' || NVL(:TEST_NBR,9999); IF :TEST_ID2 = 0 AND :TEST_ID IS NOT NULL THEN UPDATE rsn_test SET test_id2 = :TEST_NBR WHERE test_id = :TEST_ID; ELSE :TEST_ID2 := :TEST_ID2; END IF; END; end;
    0.03344 0.00013 ...Session State: Saved Item "P7_SHOW" New Value="0 and 787 and 1300"
    0.03356 0.00004 Branch point: After Processing
    0.03360 0.00048 ...Evaluating Branch: "AFTER_PROCESSING" Type: REDIRECT_URL Button: (No Button Pressed) Condition: (Unconditional)
    0.03407 0.00013 Redirecting to f?p=290:7:8717971109610:::::&success_msg=0%20row(s)%20updated%2C%201%20row(s)%20inserted.Success%2FEBD244168556408CBA714E3974918C09%2F
    0.03420 0.00012 Stop APEX Engine detected
    0.03432 0.00007 Stop APEX Engine detected
    0.03439 - Final commit
    
    

    Any suggestions?

    I have run tests on

    https://apex.Oracle.com/pls/apex/f?p=83488:1 demo/demo

    to see your problem.

    I have 2 solution for your problem.
    I add trial NOT tabular just usual block of PL/SQL

    BEGIN
    I'm IN (SELECT TEST_ID FROM RSN_TEST WHERE TEST_ID2 = 0)
    LOOP
          UPDATE RSN_TEST
             SET test_id2 = TEST_ID
           WHERE test_id = i.TEST_ID;
      END LOOP;
    END;

    and works very well, you can see in the sample.

    The other solution is to show new generated TEST_ID

    Adding a sequence as a default value for a column in a table field

    And to execute your procedure.

    I get how is with the good luck of time.

    By

  • Too many objects correspond to the primary key oracle.jbo.Key

    I get this error: Too many objects match the primary key oracle.jbo.Key when I tried to look for in a display object where the primary key is consists of more than one filed.

    Use case:

    In Jdeveloper 11.1.2.3 I Entity object called someTable this table has three fields A,B and C where the primary key is consist class towing A and B .

    I created different towing View object of someTable object enity that are someTableVO1 and someTableVO2 . Rated A in the view object somtableVO1 is a List Of Value(LOV) and the data are coming form filed A in the someTableVO2 .

    In application I have a search page that contains a drop-down list of registered A in somTableVO1 . Based on certain conditions, the drop-down list of the values in the list is not static. The value of the drop-down list is editable based on a select query run on someTableVO1 and it is based on the class thried C is NOT part of the primary key .

    The page displays the drop down menu with the correct values. But I have a ValeChangeListener method that will be activated whenever the user selects a value form the drop-down list.

    The problem is:

    The error Too many objects match the primary key is occur whenever I am executing this method.

    Support:

    I think the problem is with multiple fields for the primary key. of curse, there is an overlap in a part of the primary key (IE that paid A or B ) but the combination of A and B are always unique.

    Notes:

    1. I check the query by executing SQL Developer and it shows not all duplicate values.

    2 I don't attach code, because I think that the problem is not on (how to) this is (what to do).

    I hope that the idea is clear

    Problem solved.

    My goal was to show a summer that A form someTableVO1 as a list of value and I was trying to achieve by creating the list of value the same form Entity object . I understand that it was the wrong approach (correct me if I'm wrong). to achieve this in ADF technology, I have to do the following:

    1. Simply to drag and drop the view object from the Data Controls page.
    2. List of options appears asking how you want to display the view object (shape, chart, table, only one selection,...).

    3. Select Single Selection ->ADF one Selection

    4. Select the attributes that you want to show the user a list of values.

    Thanks for your comments.

  • using a sequence as the primary key

    I use a sequence for the primary key of the database for dimensions (following Kimball methodology). In ODI, I define another unique key as principal. It will not let you select check null = true and therefore a sequence can serve as primary. Someone at - it something differently.

    ss396s wrote:
    I use a sequence for the primary key of the database for dimensions (following Kimball methodology). In ODI, I define another unique key as principal. It will not let you select check null = true and therefore a sequence can serve as primary. Someone at - it something differently.

    You must follow the rules on the sequence
    1 > it cannot be run on the source
    2 > may not be a part of your key update
    3 > check not the null check box should not be selected
    4 > separate box must not be activated

    If you use a sequence for the primary key for the database, and then identify another or several columns are coming from the source and use that you can only identify a row. Use these columns as your key to update.

    Thank you
    Fati

  • Problem by setting the primary key: relaxation Assigned primary key in the sequence.

    I have a table and a trigger for insert/update on the table. Trigger I get the game of the primary key of a sequence. I tested unit by inserting records in the table. It works very well. Kets primary key the next sequence number.

    I use this table as an entity in my adf application. The primary key attribute is set to "DBSequence". But when inserted I do not receive the following sequence for the primary key. Instead it is inserting the temporary number - ve that assigns the adf.

    I use JDeveloper 11 g.


    Can someone tell me what could be the problem?

    Your trigger should be something like:

    create or replace TRIGGER "SID_ASSIGN"
     before INSERT
     ON MY_TABLE
     FOR EACH ROW
    
    BEGIN
    
    if :new.SID is null or :new.SID < 0 then
       SELECT MASTER_SID_SEQUENCE.nextval into :new.SID from dual ;
    end if;
    END;
    

    You can refer to the guide of Dev of 11g for more details on this...

    Julian

  • The index of the primary key in a different tablespace.

    Hello

    I have a user PROD. It has received a tablespace PROD_TBS default.
    There is a separate table for all indexes space in the diagram, PROD_IDX.

    I want to create a TEST table as follows,

    CREATE TABLE TEST
    (TEST_ID, NUMBER (1),)
    NAME VARCHAR2 (10));

    It must be a primary key on the column test_id, but such that the corresponding unique index created by default because of the primary key must be created in the PROD_IDX tablespace.

    How to do this?

    Alternative solution:

    CREATE TABLE TEST
    (TEST_ID NUMBER(1),
    NAME VARCHAR2 (10),
    constraint test_pk primary key (test_id)
    using index tablespace prod_idx
     );
    

    Cheers, APC

    blog: http://radiofreetooting.blogspot.com

  • How did the foreign key that is recognized by the primary key

    Hi, when I have two user tables and userLevel and the primary key of the user is the user name and I add a field to userLevel userID is only to make the userID field in userLevel automatically the foreign key of the table? Or do you switch the engine of MyISAM tables to InnoDB to make relational links. Can someone please explain this in English clear to me, because I just can't get my head around this.

    In the case of a query such as SELECT statement, we talked, being a key actually means that the field is indexed so that the database can quickly look up.  Thus, in phpMyAdmin, you set the field to be indexed by the visualization of the structure of the table and clicking the icon index (the one with the Lightning) for the field in the Action section.

    If you are looking for integrity refrential between tables we also talked about and using the InnoDB engine, you can click the link 'Show the relational' in the table structure page of phpMyAdmin and define foreign key constraints.

Maybe you are looking for