Home » SQL & PL/SQL » SQL & PL/SQL » Disabling unique constraints and data warehousing query
Disabling unique constraints and data warehousing query [message #639674] Tue, 14 July 2015 02:41 Go to next message
GusGF
Messages: 10
Registered: July 2015
Location: UK
Junior Member
In some material I was reading there was the following text below which left me puzzled. I don't understand what the author was getting at. How can a unique index be considered as costly in comparison to not having any index at all as is the case below? Surely this would mean queries would not have the advantage of an index and DML would be severely limited if at all.


EXCERPT

ALTER TABLE sales ADD CONSTRAINT sales_uk
UNIQUE (prod_id, cust_id, promo_id, channel_id, time_id) DISABLE VALIDATE;


This statement creates a unique constraint, but, because the constraint is disabled, a unique index is not required. This approach can be advantageous for many data warehousing environments because the constraint now ensures uniqueness without the cost of a unique index.

However, there are trade-offs for the data warehouse administrator to consider with DISABLE VALIDATE constraints. Because this constraint is disabled, no DML statements that modify the unique column are permitted against the sales table.
Re: Disabling unique constraints and data warehousing query [message #639675 is a reply to message #639674] Tue, 14 July 2015 02:45 Go to previous messageGo to next message
John Watson
Messages: 9003
Registered: January 2010
Location: Global Village
Senior Member
Can you provide the reference for where you read this? (I shall be embarassed if it was something I wrote)
Re: Disabling unique constraints and data warehousing query [message #639676 is a reply to message #639674] Tue, 14 July 2015 02:47 Go to previous messageGo to next message
John Watson
Messages: 9003
Registered: January 2010
Location: Global Village
Senior Member
And, just to do the moderator bit:

Welcome to the forum. Please read our OraFAQ Forum Guide and How to use [code] tags and make your code easier to read

--
John Watson
Oracle Certified Master DBA
http://skillbuilders.com
Re: Disabling unique constraints and data warehousing query [message #639680 is a reply to message #639676] Tue, 14 July 2015 03:33 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
That excerpt is from documentation UNIQUE Constraints in a Data Warehouse.
Re: Disabling unique constraints and data warehousing query [message #639691 is a reply to message #639680] Tue, 14 July 2015 05:09 Go to previous messageGo to next message
GusGF
Messages: 10
Registered: July 2015
Location: UK
Junior Member
Okay thanks Lalit. I'm not sure where I copied & pasted from into my notes but it could have been from the source you linked. It does seem to make a bit more sense reading it from there than my extract. Thank you for that.
Re: Disabling unique constraints and data warehousing query [message #639692 is a reply to message #639676] Tue, 14 July 2015 05:10 Go to previous message
GusGF
Messages: 10
Registered: July 2015
Location: UK
Junior Member
Thank you Smile
Previous Topic: Rowcount
Next Topic: Same serial for a group
Goto Forum:
  


Current Time: Sun Aug 09 03:09:23 CDT 2026