Indexes and constraints

Hi guys!

I did a little test and now I do not understand the result. Please explain to me the following:

(1.) I created the following table emp1

< pre >
CREATE TABLE emp1
(
EmpNo NUMBER CONSTRAINT emp1_pk PRIMARY KEY
USING INDEX
(
CREATE UNIQUE INDEX emp1_idx ON emp1 (empno)
)
);
< / pre >

2.) now, I interviewed user_indexes and user_constraints

< pre >
SELECT i.index_name, i.index_type, i.uniqueness, c.constraint_name, c.constraint_type, c.status
From user_indexes i, user_constraints c
WHERE i.table_name (+) = c.table_name
AND c.constraint_name AS 'emp1_pk '.
ORDER BY c.constraint_name;
< / pre >
The result displays the following lines:
< pre >
INDEX_NAME INDEX_TYPE UNIQUENESS CONSTRAINT_NAME, CONSTRAINT_TYPE STATUS
---------------------
NORMAL SINGLE ACTIVE P EMP1_PK EMP1_IDX
< / pre >

3.) after that I disabled the emp1_pk constraint and I Redid the same query

< pre >
ALTER TABLE emp1 DISABLE NOVALIDATE CONSTRAINT emp1_pk;

SELECT i.index_name, i.index_type, i.uniqueness, c.constraint_name, c.constraint_type, c.status
From user_indexes i, user_constraints c
WHERE i.table_name (+) = c.table_name
AND c.constraint_name AS 'emp1_pk '.
ORDER BY c.constraint_name;
< / pre >
The result displays the following lines:
< pre >
INDEX_NAME INDEX_TYPE UNIQUENESS CONSTRAINT_NAME, CONSTRAINT_TYPE STATUS
---------------------
EMP1_PK NULL NULL NULL P DISABLED
< / pre >

So far so good. I got disabling of this constraint is okay to delete the corresponding index. But in the following example, the corresponding index would not be deleted.

< pre >
CREATE TABLE emp2
(
EmpNo NUMBER
);

CREATE UNIQUE INDEX emp2_idx
ON emp2 (empno);

ALTER TABLE emp2
ADD CONSTRAINT emp2_pk PRIMARY KEY to the AID of INDEX emp2_idx;
< / pre >

2.) now, I interviewed user_indexes and user_constraints

< pre >
SELECT i.index_name, i.index_type, i.uniqueness, c.constraint_name, c.constraint_type, c.status
From user_indexes i, user_constraints c
WHERE i.table_name (+) = c.table_name
AND c.constraint_name AS 'emp1_pk '.
ORDER BY c.constraint_name;
< / pre >
The result displays the following lines:
< pre >
INDEX_NAME INDEX_TYPE UNIQUENESS CONSTRAINT_NAME, CONSTRAINT_TYPE STATUS
---------------------
NORMAL SINGLE ACTIVE P EMP2_PK EMP2_IDX
< / pre >

The result of this query is the same as emp1_pk. But at the next step, the results differ.

< pre >
ALTER TABLE emp2 DISABLE NOVALIDATE CONSTRAINT emp2_pk;

SELECT i.index_name, i.index_type, i.uniqueness, c.constraint_name, c.constraint_type, c.status
From user_indexes i, user_constraints c
WHERE i.table_name (+) = c.table_name
AND c.constraint_name AS 'emp1_pk '.
ORDER BY c.constraint_name;
< / pre >
The result displays the following lines:
< pre >
INDEX_NAME INDEX_TYPE UNIQUENESS CONSTRAINT_NAME, CONSTRAINT_TYPE STATUS
---------------------
NORMAL EMP2_PK UNIQUE P DISABLED EMP2_IDX
< / pre >

That's what I did not understand. Emp1_pk has been disabled and the corresponding index emp1_idx was abandoned. Emp2_pk has been turned off but the corresponding index has not been deleted. Can someone explain to me please, the difference between the example 1 (emp1_pk) and example 2 (emp2_pk).

Concerning

Hello

In the first example, Index was done by primary key, and when we disable the primary key, it also drops the corresponding index.
But in the second example, the Index is created on the column separately and then the primary key is created. Now that there is already an index on the primary key column will use this existing index and when we disable the constraint this index will not be droppped because it was not created by primary key. It was only used by primary key.

Concerning

Tags: Database

Similar Questions

  • Models to define templates for keys, indexes and constraints in Version 4

    Oracle SQL Developer Data Model Version 4.0.0.833

    Someone tell me where to find templates to define templates for keys, indexes and constraints?

    In version 3, it has been in tools > General Options > naming standards > models

    Hello

    In the 4.0.0.833 version, you must open the Properties dialog box for the design (by doing a right click on the entry for the relevant design in the browser tree, and select properties).

    Then in the design properties dialog box, select settings > naming Standard > models

    David

  • (ORA-00955) conflict of naming for index and constraint when you use a unique index (.. desc,.. CSA)

    Hello

    indexes and constraints are in different namespaces, so it should be possible to give them the same name.

    In the following case that apparently does not work:

    create unique index orders_year_show_uq
      on orders (year desc, show_orders asc);
     
     alter table orders
      add constraint orders_year_show_uq unique (year, show_order);
    

    When I run these statement, I get a "SQL Error: ORA-00955: name is already used by an existing object". ""

    If I clean and I execute the same instructions as above with the only difference on the 2 line, using "asc year" instead of "year desc":

    
      on orders (year asc, show_orders asc);
    

    then it success.

    I can't explain it, you have an idea?

    Thanks in advance.

    Kind regards

    Giovanni

    First of all, you have show_orders in index and show_order in the constraint. I'll assume that it's a typo. Second, when you create constraint without index enhance the specification Oracle seeks indexes existing on the same set of columns in ascending order. If this index does not exist (and it's your case, since one of your columns to index is in descending order), Oracle tries to create one with the same name as the constraint. That's why you get ORA-00955: name is already used by an existing object. In general, you can specify explicitly the index name to force the Oracle by using the existing index. But it will not help you. If you issue

    ALTER table orders add unique constraint (year, show_orders) orders_year_show_uq using index orders_year_show_uq;

    You will get the ORA-14196: specified index cannot be used to apply the constraint.

    In any case, Oracle does not support using index DESC for PK/UK.

    SY.

  • Indexing and the integrity constraint functionality difference

    Hello

    Sometimes I confuse me, how we can distinguish between indexing and the integrity of the features of constraint. Please let me know or if any available doc.


    Kind regards
    REDA

    I assume you mean unique vs unique index constraints?

    The sole (or Primary Key) constraints provide additional metadata that can be used by the optimizer.
    An index will be used to help the database to apply the constraint (it is created, or if there is it will be "captured" by coercion)

    Insofar as a document [url http://docs.oracle.com/cd/E11882_01/server.112/e25789/toc.htm] that's something, you should read

  • Index and MATCH with several conditions

    Hi all! I hope I can explain what I'm trying to do here clearly. This is my first shot:

    In the table below "Office entry Worksheet - area 1" I am trying to insert a formula in column B which will result in an answer ' true / false ' and be used for conditional highlighting

    The first condition that must be met is that the checkbox in the table "Labor and material Checklist" column A or check, if it is not checked, then move to the next line. If the box is checked, then the following condition would need to index and match with column C of table "Office entry Worksheet - area 1" in column B. If there is a match in column C, then move to the next line of column B in the table 'labor and material Checklist '. This continues until there is a 'match', then highlight column B in the table "entry Office sheet - surface 1" in red (or something like "MISSING task")

    It is an estimate and the idea is to ensure that the Phases that are checked in the table "Labor and material Checklist" will not miss when you use the table "entry office map - zone 1".

    Thank you very much for your help!

    Tim

    Is it possible that I can download this spreadsheet file?

  • Question indexing and backup...

    Couple questions.

    1 indexing - I created a directory "backup" off the rooy on my device via the file browser. Even with the pictures etc..., it's the area that I intend to backup just things, documents, programs, etc... To my surprise, images in this directory is indexed and illustrated with photos. Is this by design? In any case stop as long as these are usually the images that go with the product installs.

    2. I noticed in the backup agent it refers to \\myhubname\backup but that folder does not exist (this is why I created it). "However, on this backup operation (the one that installs by default), it stores data to \\myhubname\import\"directory file names "... strange.

    Any thoughts would be appreciated.

    Thank you.

    udflyer

    1. Yes, it's by design. Nothing in the files of importation or the media is indexed. I suggest using the backup folder.

    2. strange that the backup folder was not there. It is a default action.

  • movie maker error message: not indexed and cannot be imported

    I put my video clips imported from my digital camera of MOV to WMV with Format Factory and now get the error message in Movie Maker...

    The C:\...wmv file is not indexed and cannot be imported.

    Try using the free utility WMVIndexer . It is towards the bottom of the page in the given the download link.

    The utility should be easy to follow. It will add indexes to the .wmv clip to allow quick advance and rewind indexing so that WMM can then use in the edition.

  • What is this mean:MVI_3165 ~ 1.wmv is not indexed and cannot be imported?

    What is this mean:MVI_3165 ~ 1.wmv is not indexed and cannot be imported?

    The. WMV file may be corrupted somehow...
    and probably is unseekable. IOW... If you play
    the file in Windows Media Player, you can not
    Drag the search bar to advance the video.

    If you want to experiment with the repair of the
    . WMV file... the following freeware may be
    worth a try:

     
    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    AsfBinWin version 1.8 [version 1.8.2.903]
    http://www.radioactivepages.com/AsfBin.aspx
    (Windows XP - Vista - 7)
    (Intuitive, fast and reliable tool for processing
    ASF and WMV files)

    Good luck...

  • Windows movie maker error - the file is not indexed and cannot be imported

    I have converted a quicktime in WMW clip, but when I try and import the video in windows movie maker, that it comes up with error the file is not indexed and cannot be imported? What does that mean?

    Try another converter.

    There are to many converters available on the net...
    the following links are some examples.

    Proceed at your own risk *.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    (1) format Factory (freeware)
    http://www.videohelp.com/tools/Format_Factory
    (the 'direct link' is faster)
    (the file you want to download is: > FFSetup270.zip<>
    (FWIW... installation..., you can uncheck
    ('all' boxes on the last screen)
    (Windows XP / Vista / 7)

    First, you will need to decompress the file or just open the
    Drag FFSetup270.exe out of the folder
    and drop it on your desktop. To install left click.

    (2) Freemake Free Video Converter (freeware)
    http://www.Freemake.com/free_video_converter/
    (Windows XP / Vista / 7)

    (3) Koyotesoft Free Video Converter
    http://www.koyotesoft.com/indexEn.html
    (2000/XP/2003/Vista/Seven)

    (4) Sothink Free Video Converter
    http://www.Sothinkmedia.com/video-converter/
    (Windows XP / Vista / 7)

    (5) SUPER © Simplified Universal Player Encoder & Renderer
    http://www.videohelp.com/tools/Super
    (the download mirror site is faster) (Windows XP / Vista / 7)

    (6) Xilisoft Video Converter
    http://www.Xilisoft.com/video-converter.html
    (not freeware but receives good reviews)
    (Windows XP (SP2 or later) / Vista / 7)

  • Disabled Options of Outlook 2007 indexing and advanced search options

    Im running Windows 7 RC1 Ultimate x 64 and I recently started having a problem with Outlook 2007. Somehow all advanced search options (hit the double arrow to the right of the Inbox "search" field to specify, body, subject, etc.) are disabled - that is grayed out and I can't use them. If I go to the search options in Outlook all under the category indexing and search is also disabled. Finally, I noticed that if I go into Windows Indexing Options > change, under the heading change of the chosen places 'Microsoft Office Outlook' is grayed out as and when I go over it the ToolTip says "indexing of Outlook emails like summer disabled by the system administrator.

    I confirmed this isn't something set via Group Policy, because I have several other similar PC which presents all works very well on. The only thing I can think is vaguely remembered changing some indexing options a bit back to allegedly to increase performance, but I don't remember what that or if I did before or after loading Win7.

    Any suggestions are greatly appreciated!

    In case someone else falls on this same question, I found the answer on the newsgroups Outlook here .

    Just need to change some registry settings to get this working again.
    HKLM/Software/policies / Microsoft/Windows/Windows search
    PreventIndexingOutlook value 1

    HKLM/Software/Microsoft/Windows Search
    SetupCompletedSuccessfully to 0

    Reboot and everything is fine!

  • Click to open topics in the Index and the 'Search' tab

    I have the setting "Single click to open books" archived on parameters HTML Adv.  It works very well.  Wooo hoo!  My QA people are so happy with this feature they want the feature click to open topics in the index and search tabs.  I can't find anywhere to enable this.  Am I missing a setting?  Is it possible to 'hack' it?

    I have 10 RoboHelp and exit at Microsoft_HTML_Help.

    Thanks for the hot and humid Florida,

    Shannon

    Hello

    Sorry, but this is a limitation of CHM. Unfortunately I don't remember if it came with version 10, but if if you could use the WebHelp for the CHM converter script to package inside a CHM WebHelp output. If you do, then you would have what you want where a simple click would open things.

    See you soon... Rick

  • Indexing and who should do it

    I work for a company that has a fairly large data warehouse Oracle that we use to store the SAP data dissemination (about 500 M of lines for some tables). Tables are not indexed and if I try to reach them on the query takes hours to complete. If the DBA needs to be proactive and create these indexes in order to reduce the load on the database?

    The team wants to load our 40 hours for 3 indices Department ADMINISTRATOR has already provided a script for. I'm naïve or y at - it something crazy to need 40 hours to implement 3 clues? I should mention that these tables is related to SAP and should be indexed to joined already IMO.

    I'm just trying to understand if I'm missing something.

    Thank you

    Creation of parallel indexing can reduce your time to create, but you must "alter index noparallel xyz" after its creation if you want really not parallel to this topic.

    Another impact on the creation of index how long does is how fast your hardware (processors, processor speed, speed of SAN etc.), but also what else is no running on the database in time using server resources.

    On an AIX Power 7-3 processor (quad core) production server it took me about 15 minutes to create an index on a table of 600 million lines running at the same time 8.

    On an AIX Power 5-4 Intel (quadruple-heart) test server it took about twice as long.  The SAN on production was super fast as well which had impact on how long it took.

    There are other factors that will affect the creation time.

    Specifically that I seriously doubt they can justify bill you for 40 hours.  It is unlikely that someone will run a script and then watching the screen for the next 40 hours waiting for the index to create... unless they are a bunch of clowns.  More than likely they run the script, go and do other things and periodically check to see if she has completed.

    Your IT team is having a laugh.  It should be fun to ask them to justify and to break the 40 hours.  minute to copy the script on the server, 30 seconds to go, 30 seconds to run the script.  39hrs, of 58 minutes watching the screen ready to create index at the end... Hmm... sounds fishy to me.

  • Are there patches IE11 and Chrome for RoboHelp for Word 10? Table of contents, Index, and search do not work as expected in WebHelp...

    Question:

    Fixes IE11 and Chrome on the Adobe web site ask you to put their new files in RoboHTML templates_stock folder. However, I need these fixes for RoboHelp for Word. Is there a such difficulty?

    Background:


    I use 10 RoboHelp for Word, generating WebHelp.

    I try to solve the problems about the table of contents, Index, and search appears not not or not being not completely functional IE11 or Chrome, not including many of our customers use. I found a couple of workarounds that my boss doesn't like.

    • In IE11, if the end user adds the web site to the compatibility view list, they all appear and function correctly, but my boss is adamant about not wanting the end user having to do anything to solve the problem.
    • In Chrome, I can get a table of contents and a non-functional search to appear if the user turns off JavaScript for the site, but this solution also violates the lists see also in help. Again, made my boss wants to not that the end user to have to do.

    His solution is just to generate using pure HTML, but then the search won't work in IE11 or Chrome (I'm not sure about Firefox). I are based largely on the research, when I'm working on the product, so I really don't want to lose the search function.

    Help, please.

    Kind regards

    Jenn

    As I said in my reply to your message in the RoboHelp for Word forum, there is no patch for this.

    I can understand your not wanting to Manager end users will do anything and agree with him. However, the fixes for these issues in HTML HR are simply not available in RoboHelp for Word.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • spatial index and normal index

    Hi space specialists,.

    I have a question for spatial index performance and how Oracle manages queries that have a space and regular condition combined. We are on the Oracle 10 g Enterprise Edition Release 10.2.0.4.0 database

    Take a query like this one (not a real query but based on the type of query that is generated by ArcGIS):

    Select objectid

    attribute

    geometry

    table

    where mdsys.sdo_filter (geometry, mdsys.sdo_geometry (: gtype1,: srid1, null,: elem_info1,: ordinates1), 'querytype = window') = 'TRUE '.

    and attribute = value

    In our scenario, we have a lot of rows in the table (2 million), but we have only a few lines (2000) where attribute = value.

    It seems that there is a scenario where the performance is really bad. It takes 5 seconds for the query to return the results and you're just too slow for our needs. There is a spatial index on a geometry and a normal index on the field for the attribute. The plan of the explain command shows that both the spatial index and the index of the attribute are used.

    Of course, we can break to the top of the table in separate tables by object type. This would make the index space datamodel much more efficient, but at the expense of our current simple, abstract.

    Do you have suggestions on how we can improve performance without too much impact on our datamodel? Oracle for example has an option where you can create a spatial index on a subset of the data in a table?

    Thank you!

    Rob

    Do not know whether or not the following works for your case:

    use the column range-key attribute to create a partitioned table Beach and then create a local spatial index.

  • What happens to the existing after the partition of table index and created with local index

    Hi guys,.

    / / DESC part id name number, varchar2 (100), number of wage

    In an existing table PART I add 1 column DATASEQ MORE. I wonder the part of table based on dataseq.now, the table is created with this logic of partition

    create the part table partition (identification number, name varchar2 (100), number of salary, number DATASEQ) in list (dataseq) (values partition PART_INITIAL (1));

    Suggestionn necessary. given that the table is partitioned based on DATASEQ I wonder to add local indexes on dataseq. to dataseq, I have added a local index create index idx on share (dataseq) LOCAL; Now my question is, already, there are the existing index is the column ID and salary.

    (1) IDX for dataseq is created locally so that it will be partition on each partition on the main table. Please tell me what is happening to the index on the column ID and salary... it will create again in local?

    Please suggest

    S

    Hello

    first of all, in reality 'a partition table' means create a new table a migration of existing data it (although, theoretically, you can use dbms_redefinition to partition an existing table - however, it's just doing the same thing behind the scenes). This means that you also get to decide what to do with the index - index will be local, who will be global (you can also reassess some of existing indexes and decide that they are not really necessary).

    Second of all, the choice of the partitioning key seems weird. Partitioning is a data management technique more that anything else, in order to be eligible, you must find a good partitioning key. A column recently added, named "data_seq" is not a good candidate. Can you give us more details about this column and why it was chosen as a partitioning key?

    I suspect that the person who proposed this partitioning scheme made a huge mistake. A non-partitioned table is much better in all aspects (including the ease of management and performance) that divided one wrongly.

    Best regards

    Nikolai

Maybe you are looking for