creating a unique index of instaed of using the primary key index
HelloI 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
Tags: Database
Similar Questions
-
How to extract the values of the line full in the bean to support using the primary key
Hello
I have a table that has columns as plant_name, business planner email id and identification of email resident engineer. Here, Plant_name is the primary key.
Now, I have this plant's name slipped and dropped like selectonechoice (drop) on page jsff. In this user can select any name of 1 plant drop down.
Right now, I can go get plant in backing bean name, but I can't understand how business plan for extraction and identification of email of the engineer resident in this key primary-plant_name at the bean to support.
Please let me know if anyone has an idea in this regard.
JDeveloper version 11.1.1.6.0
Thanks in advance.
Sneha
Sneha211 wrote:
On the jsff page
required = "#{bindings." Plant.hints.Mandatory}.
shortDesc = "#{bindings." Plant.hints.ToolTip}.
ID = "soc1" unselectedLabel = "- Select -"
autoSubmit = 'true '.
Binding = "#{backingBeanScope.backingbean.plantbean}" > "
ID = "si1" / >
In backing bean
DCBindingContainer = lBindingContainer
(DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();
DCIteratorBinding lBinding = lBindingContainer.findIteratorBinding("SupplierVO1Iterator");
NewRow row = lBinding.getCurrentRow ();
String aamplant1 = (String) newRow.getAttribute ("Plant");
Hi Sneha, you've written code for it
you have found the current line and the primary key then this line, then why you not not using this same rank to get the other attributes?
NewRow row = lBinding.getCurrentRow ();
String aamplant1 = (String) newRow.getAttribute ("Plant");
String businessPalnner = (String) newRow.getAttribute ("business_planner"); Returns the value of the same line
Engineer in String = (String) newRow.getAttribute ("engineer");
OR if your condition is like that-
you have a primary key field value, but you do not have the corresponding line, then you can get that line and it's attribute by using the primary key value
See - http://adfgouravtkiet.blogspot.in/2012/10/filtering-of-data-from-vo.html
Hope it helps
-Ashish
-
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 EhrhardtGus.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
-
How to find duplicate keys found when error ORA-01452: cannot CREATE a UNIQUE INDEX.
Hi gurus,
I fall for this stupid error
"cannot CREATE a UNIQUE INDEX; duplicate keys found.
It is that the Unique Index key is composed of multiple columns
CREATE A UNIQUE KEY001AUTORISATIONS_APPORT ON TFT_AUTORISATIONS_APPORT INDEX
(AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION)
TABLESPACE KEYS_TFT NOPARALLEL NOLOGGING
Now,.
My question is, how to find duplicates keys blocking Index creation?
Thanks if you can help
Run this query to display the list of the duplicates already existing.
Select AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION, count (1) as cnt
of TFT_AUTORISATIONS_APPORT
Group
AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION
view count (1) > 1
Concerning
NJ
-
How can I stop Photoshop CS4 create a new layer each time I use the online tool?
How can I stop Photoshop CS4 create a new layer each time I use the online tool?
Whenever I use the online tool, a new layer is created. How can I stop this? No settings have been changed.Thanks in advance.Look at the three options in the top bar.
-
Why Illustrator does not accept the 'F1' key as a shortcut? I deleted the default keyboard to "clipping mask/do" command and now I can't use the "F1" key All other command options are used for other shortcuts. Should I delete the Illustrator preferences and start again? If so, how do I?
What OS? If a Mac, go to System Preferences and check the box that says deal with F-keys regular keys (or something to that effect). This will trigger the F keys to be used in artificial intelligence.
-
by specifying the index tablespace in to disable the primary key constraint
Hello
during the ETL I want to disable constraints PK/UK to speed up the load;
on activation of the constraint, the corresponding indices are created in a different tablespace while they were initially on the creation of the table itself
I tried to disable PK / UK with the option 'keep the index', the index value corresponding to the status of "unusable" and use ' alter session set skip_unusable_indexes = true', but then I can't insert rows with the error.
can anyone tell if there is a way to allow the PK/UK constraint and specify the storage space for the corresponding indices, or keep the index and inserts works?Error: ORA-01502: index 'xxx' or partition of such index is in unusable state
I'd like to avoid to drop constraints / indexes and re-create them both from scratch after the load
Thank you for the advice
Thank you
Rgds>
can anyone tell if there is a way to allow the PK/UK constraint and specify the storage space for the corresponding indices, or keep the index and inserts works?
I'd like to avoid to drop constraints / indexes and re-create them both from scratch after the load
>
Have you tried specifying the table space in the USING clause when you activate the constraint?ALTER TABLE emp ENABLE PRIMARY KEY USING INDEX TABLESPACE myTS;
See DBA guide
http://docs.Oracle.com/CD/B28359_01/server.111/b28310/indexes003.htm
>
Creating an Index associated with a constraintOracle database applies a UNIQUE key or a constraint integrity PRIMARY KEY on a table by creating a unique index on the unique key or primary key. This index is created automatically by the database when the constraint is enabled. No action is required by you when you run the CREATE TABLE or ALTER TABLE statement to create the index, but you can optionally specify an ESCALATION using clause to exercise control over his creation. This includes them when a constraint is defined and enabled, and when a constraint defined but disabled is selected.
>
Note the last sentence two sentences:
>
You can optionally specify an ESCALATION using clause to exercise control over his creation. This includes them when a constraint is defined and enabled, and when a constraint defined but disabled is selected.
>
You realize, I hope, that the only way can Oracle KNOWS that the index contains valid values is to rebuild? -
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)
-
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
-
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...
-
Can I use the product key for windows 7 Home Premium
Can I use the product key for windows 7 Home premium without sp1 to install windows 7 Home Premium SP1. also, please provide the link for both.
Msft.digitalrivercontent downloading is legal.
Download Windows 7 proper. ISO file that includes Service Pack 1
Windows 7 Home Premium 32 Bit: http://msft.digitalrivercontent.net/win/X17-58996.iso
Windows 7 Home Premium 64-Bit: http://msft.digitalrivercontent.net/win/X17-58997.iso==========================================================
Downloading is legal
==========================================================
After downloading the file correct .iso using ImgBurn or ISO gear to burn a bootable DVD.
Create a Windows 7 Bootable DVD using the. ISO file
Engraving of a file of Windows 7 ISO on a DVD
http://support.Microsoft.com/default.aspx/KB/977640ImgBurn - in addition to supporting the creation of CD/DVD of. ISO files,
It supports a wide range of image file formats, and it's free.
(BIN, CUE, DI, DVD, GI, IMG, MDS, NRG, PDI and ISO)
http://www.ImgBurn.com/Projectiles help you to use ImgBurn to screen: http://www.imgburn.com/index.php?act=screenshots
Burn the ISO Images with ImgBurn article: http://neosmart.net/wiki/display/G/Burning+ISO+Images+with+ImgBurn
(Les étapes sont les mêmes pour Windows 7 ou Windows 8), except that you do not create a repair disk but complete an installation DVD)Note: Always use high quality DVD + R media and slower burning (4 x or 6 x) speed is offered a choice.
J W Stuart: http://www.pagestart.com
-
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 advanceOracle, 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
-
Print layout on screen rotation when you use the arrow keys
I must have accidentally pressed a wrong key combination. Now, when I use the arrow keys on the keyboard while typing of text, orientation changes screen, according to which key I hit it, I hit the down arrow, the text on the printed page rotates 180 degrees.
How can I fix it?
Biggar Gordon
Houston, Texas
Thanks for your reply.
I googled the question of fun and learned you can hit CTRL + Alt + an arrow key to change the direction of the display on the monitor. Pressing on the same new keys cancels the function. I must have accidentally done to create the mess in the first place.
I've done the same thing if I had rebooted the system.
Thank you very much!
Biggar Gordon
-
Can I use the Vista key code to activate this Windows 7?
Original title: Windows 7 and key code
I have a Dell laptop that I replaced the drive on. Originally Vista and Windows 7. I reloaded Vista but if I load this https://www.microsoft.com/en-us/software-download/windows7
Can I use the Vista key code to activate this Windows 7?
No, you need the product key for Windows 7, Windows 7 uses its own unique product key. What you can do is to reload the old hard drive, and then try to recover the product key:
Here are four utilities, which can display your product keys if they are still there:
Belarc Advisor: http://www.belarc.com/free_download.html
(He did a good job of providing a wealth of information.)Also: http://www.magicaljellybean.com/keyfinder.shtml
and: http://www.nirsoft.net/utils/product_cd_key_viewer.html
and RockXP: http://www.majorgeeks.com/download4138.html which has additional features -
generate a numerical value to use as the primary key
Can someone correct me, in an interview that the question was asked.
How not one generates a numeric value to use as the primary key?
Years
We can get it using the sequence. For example:
CREATE SEQUENCE cust_seq
START BY
1000INCREMENT OF
1NOCACHE
NOCYCLE;
Hi Shu,
sequence would be my choice and 12 c new type called identity.
Maybe you are looking for
-
Problem with my HP Compaq notebook 6910p
When I install any OS 7, 8.1, or all 10 cards are being Setuped except the video card (ATI mobility Radeon 2300 X), I searched a lot for its installation, but nothing. I downloaded several catalysts but without any progress. even I entered the offici
-
Hello I'm doing a tension of 3-story ramp. One who goes from 0V to-1V can-1V to + 1V and finally wear the voltage of + 1V to 0V. The main feature is that I try to sync input only a channel for the median ramp. I get the expected input but my outpu
-
Help! my icons multisim and ultiboard are too small
my icons are too small and I feel that the words are bigger than they should be, nobody knows the reason for this and if so can you please suggest a solution. Thank you. I've attached a picture to show you exactly what I mean.
-
I must have deleted Director and now I can't find a way to separately download or obtain SP3.
Any help appreciated. Download SP # or Moviemaker
-
PC does not recognize the exteranl drives
with windows 7 I cnanot than my pc to recognize external usb devices-jahrd and stciks memory - readers request for drivers who are not available