Optimize creation of UNIQUE constraints which can be determined to be already 
Unique based on other constraints.
----------------------------------------------------------------------------------------------------------------

                 Key: CORE-4956
                 URL: http://tracker.firebirdsql.org/browse/CORE-4956
             Project: Firebird Core
          Issue Type: Improvement
    Affects Versions: 3.0 Beta 2
            Reporter: Tim Kelly


Optimization request:

I have a large database and regularly have to create/modify UNIQUE constraints. 
Most of my unique constraints contain two fields where the first field is 
already the primary key, I create them to allow foreign keys to point to them. 
I notice that is can sometimes take a long time to create the unique 
constraint. Presumably a check is being performed that the existing data will 
not violate the unique constraint. If so this step should not be required if it 
can be determined that the UNIQUE constraint will already be unique by 
definition. In my case:

ALTER TABLE MASTER ADD CONSTRAINT C UNIQUE (A,B);

Where A is the primary key of MASTER. We know 100% that the existing data will 
not violate this constraint.

Since A is already known to be a primary key then it should not be necessary to 
check the data before creating the constraint.

If I then created another constraint D:

ALTER TABLE MASTER ADD CONSTRAINT D UNIQUE (A,B,C);

Again no checks should need to be carried out as we already know that A,B is 
unique so A,B,C will always be unique too.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to