Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does Unique constraint on multiple columns has performance issues -Oracle

I am using Oracle database and I have a table for customers records and want to put a Unique key constraint on multiple varchar2 columns. like

CUST_ID (Number),

CUST_Name(varchar2),

Cust_N.I.C_NO(varchar2) will make a unique key.

when inserting new record through forms 6i, if ORA-00001 error comes, user will be informed that it was a DUPLICATED record.

Please advise me if there will be any database performance issue when records in this table will exceed 50000 or more.

If this is not a good practice to avoid inserting duplicate records, then please suggest any other approach.

regards.

like image 268
user1115284 Avatar asked Dec 08 '25 22:12

user1115284


1 Answers

Unique constraints are enforced though an index. So there are additional reads involved in the enforcement process. However, the performance impact of the constraint is minimal compared to the performance impact incurred by resolving duplicate keys in the database. Not to mention the business impact of such data corruption.

Besides, 50000 rows is a toy-sized table. Seriously, you won't be able to measure the difference of an insert with and without the constraints.

like image 124
APC Avatar answered Dec 10 '25 22:12

APC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!